View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Nigel Bennett Nigel Bennett is offline
external usenet poster
 
Posts: 41
Default Scroll thru multiple spreadsheets

I'm not sure what your code is doing as it doesn't seem to
be doing anything to the worksheets, I get the eror
message user defined type not defined

also can you make each sheet the active sheet as it moves
thru the code

here is the code as I put it in
Dim objSht as Sheet
For each objSht in ThisWorkbook.Worksheets

Application.Run Macro:=("EssMenuRetrieve")
Next objSht


-----Original Message-----
Well, its a bit vague your question but i would suggest

that scrolling
through by name is one of the least efficient ways...

Try one of these...

''This one will loop through all Worksheets in a workbook
Dim objSht as Sheet
For each objSht in ThisWorkbook.Worksheets
.....yuor code here
Next objSht

But, if you have Chart sheets as well and you want to

loop through them
as well as worksheets then you need to take a slightly

different
approach I think...

Dim intShtCount As Integer
For intShtCount = 1 To ThisWorkbook.Sheets.Count
'''Your code here
Next intShtCount


Hth,
OJ

.