I have a macro that should run but I am linking it to cell N14 for the file name and cell N16 for the Worksheet tab name.
I cannot get this macro to run and it stops where I reference the worksheet name in cell N16.
If someone could look at this and possibly assist me, I would appreciate it.
Thank you,
Ray
------------------------------------------------
I cannot get this macro to run and it stops where I reference the worksheet name in cell N16.
If someone could look at this and possibly assist me, I would appreciate it.
Thank you,
Ray
------------------------------------------------
Code:
Sub Macro3(ws As Worksheet)
'
' Macro3 Macro
'
' Keyboard Shortcut: Ctrl+g
'
Workbooks.Open ws.Range("N14").Value
Worksheets wks.Range("N16").Activate
'
'
Dim wks As Excel.Worksheet
On Error Resume Next
Set wks = ThisWorkbook.Worksheets(Sheets("Start").Range("N16").Value)
On Error GoTo 0
If Not wks Is Nothing Then
Call wks.Activate
'Worksheets("July 2018").Activate where the value of cell N16 is July 2018
Range("A3").Select
Selection.AutoFilter
Columns("A:E").Select
Selection.EntireColumn.Hidden = False
Rows("3:3").Select
Selection.AutoFilter
ActiveCell.Offset(0, 0).Range("A2:BR26000").Select
ActiveSheet.Range("$E2").AutoFilter Field:=5, Criteria1:= _
"Haugland"
Selection.Copy
Windows("VBA Extractor r57with code V2.xlsm").Activate
Worksheets("Const. Prog. Rpt Switches").Activate
ActiveCell.Offset(0, 0).Range("A1").Select
'ActiveCell.Offset(0, 0).Range("A2").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False
Call refresh
' End If
End Sub