For Each c In Worksheets("1").range("I2:I100")

Todd_M

Board Regular
Joined
Feb 24, 2002
Messages
117
Hi-
The formula:

For Each c In Worksheets("1").range("I2:I100")

Will search for a c value in sheet 1, range I2 to I100. Say if I have 12 sheets named 1 thruogh 12 and I want the c.value to search in each sheet,range I2 to I200. How would one adjust this code so that it searches all 12 sheets at once??
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
On 2002-04-27 17:13, Todd_M wrote:
Hi-
The formula:

For Each c In Worksheets("1").range("I2:I100")

Will search for a c value in sheet 1, range I2 to I100. Say if I have 12 sheets named 1 thruogh 12 and I want the c.value to search in each sheet,range I2 to I200. How would one adjust this code so that it searches all 12 sheets at once??

This will search ALL sheets;

<Pre/>

Dim Sh As Worksheet

For Each Sh In ActiveWorkbook.Sheets
For Each c In Sh.Range("I2:I100")
'//
Next c
Next Sh

</pre>
 
Upvote 0

Forum statistics

Threads
1,214,593
Messages
6,120,435
Members
448,962
Latest member
Fenes

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top