View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Corey Corey is offline
external usenet poster
 
Posts: 276
Default Code to look at all sheets not just specified sheet ?

I have been assisted with this code by some very helpful people, but i have
narrowed it down to these lines below that i need to modify slightly.

How can i change the [Worksheets(4)] in (2)two instances below to refer to
ALL(could be anywhere from 2-49) sheets in the workbooks instead ?


If mybook.Worksheets(4).Range("B3").Value = input1 And
mybook.Worksheets(4).Range("D3").Value = input2 Then
mybook.Worksheets(4).Copy
After:=basebook.Sheets(basebook.Sheets.Count)

The 3rd instance of Worksheets(4)[Worksheets(4).Copy] needs to be the sheet
that contains the 2 range values (B3" & "D3"),
where the other 2 instances [worksheets(4)] need to refer to ALL sheets in
the workbook.



Regards

Corey....