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

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
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,215,326
Messages
6,124,272
Members
449,149
Latest member
mwdbActuary

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