Hey Gurus!
Any idea why this code works perfectly inside of a module, but not if i put it in a GoSub / Return routine in a sheet code?
It cycles thru the sheets, but does not perform the For/Next functions.
As I say tho, if I call the module with the exact same code, it works fine.
I've tried all I can think of, so time to ask for some thoughts.
Rodger
Any idea why this code works perfectly inside of a module, but not if i put it in a GoSub / Return routine in a sheet code?
It cycles thru the sheets, but does not perform the For/Next functions.
As I say tho, if I call the module with the exact same code, it works fine.
Code:
Months = Array("enter sales", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")
For Each Month In Months
Worksheets(Month).Activate
ActiveSheet.Unprotect
For c = Range("D10").Column To Range("BL10").Column Step 2
If Cells(9, c).Value = "Y" Then
Range(Cells(x + 3, c), Cells(256, c)).Copy
Cells(x + 4, c).PasteSpecial Paste:=xlPasteValues
Cells(x + 3, c).Value = 0
End If
Next c
I've tried all I can think of, so time to ask for some thoughts.
Rodger