Thread: For Each, Next
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default For Each, Next

Hi
you probably hardcoded the activesheet in your 'othermacro'. You have
to pass the worksheet object to your other macro and use this as
reference for your macro

--
Regards
Frank Kabel
Frankfurt, Germany


wrote:
I have the following macro than contains another macro:

Sub MonthList()

Dim wks As Worksheet

For Each wks In Worksheets
OtherMacro
Next wks

End Sub

However, when i run it, OtherMacro (a list of months) only
get executed in the active worksheet. What am i doing
wrong?

regards