Thread
:
Code to look at all sheets not just specified sheet ?
View Single Post
#
3
Posted to microsoft.public.excel.programming
Corey
external usenet poster
Posts: 276
Code to look at all sheets not just specified sheet ?
Thanks David for the reply.
I can seem to get the code to work great if i set it to a local folder,(Did
this to test and setup)
But as i need it to look to a folder on a network as:
MyPath = "\\Office2\my documents\folder name"
ChDrive MyPath
ChDir MyPath
I get an error in the ChDrive My Path
and ChDir My Path
Any idea's whay that is ?
And how to rectify it.
Corey....
Regards
Corey McConnell
Manager - Splice Tech Unanderra Pty Ltd
P - 02 4272 8822
F - 02 4272 8833
M - 0408 402 522
E -
"Dove" wrote in message
...
Corey,
Add the following (wrapping around your code with 3 changes) and it should
work:
Dim i as Integer
mybook.Activate
For i = 2 to Sheets.Count
' Put the code you have below here, replacing the "Worksheets(4)" with
"Sheets(i)" in all 3 instances
Next i
I don't know of a way to do all at once, only to step through each sheet
one at a time...
David
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....
Reply With Quote
Corey
View Public Profile
Find all posts by Corey