Using the cell list used in a For Each statement as a reference for another cell needed

jjsauer

Board Regular
Joined
Jan 11, 2012
Messages
58
Hello,
I have a longer code, but I'll save space. Essentially I have a "For Each rCell in Range..." code and I want to use that moving rCell as a reference to create another variable (sCell) that is used just for that one rCell, then on to the next rCell.

For Each rCell In Range(Range1a, Range1b)
If rCell Is Nothing Then
Else
With Workbooks("FY12-Q3 Data Tables.xlsx").Sheets("TOTAL RESPONDENTS").Columns(1)
Set sCell = rCell.Offset(0, 1).Value
Set c = .Find("[" & rCell & "B" & "]", LookIn:=xlValues)
Set c = .Find(sCell, After:=c)
Set c = .Find("Bottom 2 (NET)", After:=c)

If I have to I can move rCell to the other variable and double the code to eliminate the use of two cell variables (rCell and sCell), but I would need help with this part:
How would I then write a For Each/If statement that skips Blanks AND specific text. For example, I would want the range to be really long and skip all blanks cells and cells with "Name Brand" text and cells with "Private Brand" text. I tried to play with that on a different sheet, but couldn't get it quite right. I have also skipped that sheet and possibly fixed what was causing it not to work above...

All help is very much appreciated.
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

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