• Interesting Anomaly

    From noodnutt@gmail.com@21:1/5 to All on Tue Jan 28 16:46:27 2020
    Hi All

    All but Sheets("Menu") are xlSheetHidden (Not xlVeryHidden).

    I can Import Data into Sheets("Import 1") with no issues, but!!!

    When I got to do the next step, which is to begin the conversion process, it goes awry.

    Here's the code I have, which clearly points to Sheets("Import 1"), so I am not using activesheet anywhere, but when the code hits the following line .Columns("G:G").Cut Destination:=Columns("A:A") in Delete_Unwanted_Data_Cols() it try's to convert
    Sheets("Menu").

    Do I have to make Sheets("Import 1").Visible = True in order for this conversion to happen, leaving the Menu Sheet alone, or am I doing something wrong here..???

    Aside from the Menu Sheet, I would rather have all the other sheets hidden. I know most of the Admin peeps are relatively good, but I can envisage lazy ones in the future keeping them visible which defeats the purpose of controlling the workbook, for me
    at least.

    Sub Delete_Unwanted_Data_Rows()

    Dim LR As Long, i As Long

    With Application
    .ScreenUpdating = False
    End With

    With Sheets("Import 1")
    LR = .Range("E" & rows.count).End(xlUp).Row
    For i = LR To 2 Step -1
    If IsError(Application.Match(.Range("E" & i).Value, Sheets("Location").Columns("E"), 0)) Then .rows(i).Delete
    Next i
    End With

    Application.Wait (Now + myTI * 250)

    With Application
    .ScreenUpdating = True
    End With

    Call Module2.Delete_Unwanted_Data_Cols

    End Sub
    Sub Delete_Unwanted_Data_Cols()

    With Application
    .ScreenUpdating = False
    End With

    With Sheets("Import 1")
    .Columns("A:C").ClearContents
    .Columns("G:G").Cut Destination:=Columns("A:A")
    .Columns("F:F").Cut Destination:=Columns("C:C")
    .Columns("D:D").Cut Destination:=Columns("F:F")
    .Columns("J:J").ClearContents
    .Columns("H:H").Cut Destination:=Columns("J:J")
    .Columns("K:L").Delete shift:=xlLeft
    .Columns("AA:AB").Delete shift:=xlLeft
    .Columns("L:Y").Delete shift:=xlLeft
    End With

    Application.Wait (Now + myTI * 250)

    With Application
    .ScreenUpdating = True
    End With

    Call Module2.Convert_Import_1

    End Sub

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From GS@21:1/5 to All on Wed Jan 29 01:09:04 2020
    Your code implements CutCopyMode, which only works on visible sheets! So.., to comply with your wish to keep the target sheet hidden:

    Application.ScreenUpdating = False 'hide following activity from user
    'unhide the target sheet
    'do whatever...
    'hide the sheet
    'Application.ScreenUpdating = True

    --
    Garry

    Free usenet access at http://www.eternal-september.org
    Classic VB Users Regroup!
    comp.lang.basic.visual.misc
    microsoft.public.vb.general.discussion

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From noodnutt@gmail.com@21:1/5 to All on Wed Jan 29 00:55:10 2020
    Hi Garry

    Seems totally logical once you explained it, and I should scold myself for not seeing the obvious forest thru the trees on this one.

    Thank you for the chainsaw.. :)

    Cheers
    Mark.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)