Loop worksheets

  • Thread starter Thread starter merry_fay
  • Start date Start date
M

merry_fay

Hi,

I have the following code:
Sub Hardcode()
For Each wks In ActiveWorkbook.Sheets
If Range("A4").Value < 400 Then
Call PriorYr
Call Actuals
Call Budget
Call Forecast
Else
End If
Next wks
Call Delete_Datasheets
End Sub

As far as I can see it's all correct, but the sheets aren't looping (next
wks not working). Does anyone know why or have any suggestions?
The total number of sheets in the workbook varies.

Thanks
merry_fay
 
You didn't say which worksheet range to check.

Sub Hardcode()
For Each wks In ActiveWorkbook.Sheets
If wks.Range("A4").Value < 400 Then
Call PriorYr
Call Actuals
Call Budget
Call Forecast
Else
End If
Next wks
Call Delete_Datasheets
End Sub
 
Hi,

the sheets are looping but not the range, try this line

If wks.Range("A4").Value < 400 Then

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top