Hello, I'm getting the Expected function or variable error in my code and I need a bit of help.
The code is:
wsQUERY_CHART.Activate
Range("AA1:AL65536").ClearContents
Windows("dds_Depth_of_Sku_" & MONTH_FLAG & "_" & CALENDAR_YEAR & ".xls").Activate
If WEEK_OF_MONTH = 1 Then
With wsBOM.Activate
Range("H9:I9").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
End With
ElseIf WEEK_OF_MONTH = 2 Then
With wsWEEK1.Activate
Range("H9:I9").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
End With
ElseIf WEEK_OF_MONTH = 3 Then
With wsWEEK2.Activate
Range("H9:I9").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
End With
ElseIf WEEK_OF_MONTH = 4 Then
With wsWEEK3.Activate
Range("H9:I9").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
End With
ElseIf WEEK_OF_MONTH = 5 Then
With wsWEEK4.Activate
Range("H9:I9").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
End With
End If
The error highlights the ".Activate" part in blue on the "wsWEEK4.Activate" code. But what I don't understand is, if I comment the next 7 lines out starting with "ElseIf WEEK_OF_MONTH = 5 Then", then i get no error for the first 4 Elseif statements. Also, WEEK_OF_MONTH should currently = 3 right now in the excel so I don't understand why it even runs the statements in WEEK_OF_MONTH = 5. I'm very confused why this is happening. Please help, thank you!!!
Bookmarks