Hi all, i have a loop which is supposed to move on to the next step in the loop if a given date exists in a range held on another tab (i.e. bypass the procedure to be carried out) but this does not happen even though the the code realises the date does exist in the range (i.e. True is given). I have attached a sample WB but the code is shown below (sorry i/m unable to use code tags - mods are looking into):
Sub PH()
'Extract from bigger piece of code
'Submit Forecast for given task
Dim FDate As Date
Dim PH
PH = "A2:A25"
For y = 0 To 4 'Loop through columns required to conduct check
'DEFINE DATES FOR FORECAST (as on WB row 2)
If y = 0 Then FDate = Sheets("Forecast").Range("F2") 'Monday date
If y = 1 Then FDate = Sheets("Forecast").Range("H2") 'Tuesday date
If y = 2 Then FDate = Sheets("Forecast").Range("J2") 'Wednesday date
If y = 3 Then FDate = Sheets("Forecast").Range("L2") 'Thursday date
If y = 4 Then FDate = Sheets("Forecast").Range("N2") ' Friday date
'DEFINE DAY FOR FORECAST (as on WB row 1) & NOTE COLUMN REFERENCE
If y = 0 Then DoW = "Mon"
If y = 1 Then DoW = "Tue"
If y = 2 Then DoW = "Wed"
If y = 3 Then DoW = "Thu"
If y = 4 Then DoW = "Fri"
DoWCol = Application.WorksheetFunction.Match(DoW, Rows(1), 0)
'CHECK IF F DATE IS A PUBLIC HOLIDAY AND IF SO - SKIP THIS STEP AND MOVE TO NEXT COLUMN
If Application.CountIf(Range(PH), FDate) > 0 Then GoTo PubHol
For x = 1 To 5
Cells(x + 8, DoWCol) = "Volume here"
Next x
PubHol: 'Move to next column
Next y
Exit Sub
Bookmarks