skull_eagle
Board Regular
- Joined
- Mar 25, 2011
- Messages
- 89
Hi,
I'm using the attached sub to copy visible cells to a new sheet.
The problem is I want to display the new sheet for the user but as soon as I make it active or minimize the original sheet the sub won't end.
I have to access the code and manually push the stop button.
I'm using the attached sub to copy visible cells to a new sheet.
The problem is I want to display the new sheet for the user but as soon as I make it active or minimize the original sheet the sub won't end.
I have to access the code and manually push the stop button.
VBA Code:
Private Sub Display_BTN_Click()
Dim OrWS As Workbook
Set OrWS = ThisWorkbook
Sheets.Add After:=ActiveSheet
ActiveSheet.Name = "Results"
Sheets("RawData").Select
ActiveSheet.ListObjects("Table_RawData").Range.Select
Selection.SpecialCells(xlCellTypeVisible).Copy
Sheets("Results").Select
Range("A1").Select
ActiveSheet.Paste
Cells.EntireColumn.AutoFit
Columns("CB:CB").Delete Shift:=xlToLeft
Columns("CA:CA").Delete Shift:=xlToLeft
Columns("B:B").Delete Shift:=xlToLeft
Columns("A:A").Delete Shift:=xlToLeft
Range("A1").Select
Sheets("Results").Move
OrWS.Activate
Sheets("RawData").Select
ActiveWindow.WindowState = xlMinimized
End Sub