Help needed with FOR EACH CELL IN RANGE macro

jjsauer

Board Regular
Joined
Jan 11, 2012
Messages
58
Hello,

I was trying to use the reference point (moving address) of the cells that get cycled in a FOR EACH CELL IN RANGE macro. MY issue is I cannot figure out how to return the info from the cell offset from For List cell...See in red. I get a "Type Mismatch" error...


Sub DCL()

Dim rCell As Range
Dim Range1a As Range
Dim Range1b As Range
Set Range1a = Range("Start")
Set Range1b = Range("End")

Windows("FY12-Q3 Value Tracker Key Measure Summary Tables FINAL.xlsm").Activate
Sheets("Division Category Level").Select
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 c = .Find("[" & rCell & "B" & "]", LookIn:=xlValues)
Set c = .Find(rCell.Offset(0, 1).Value, After:=c)
Set c = .Find("Bottom 2 (NET)", After:=c)
End With
rCell.Offset(0, 14).Value = c.Offset(, 14).Value
rCell.Offset(0, 26).Value = c.Offset(, 3).Value
rCell.Offset(0, 27).Value = c.Offset(, 12).Value
rCell.Offset(0, 28).Value = c.Offset(, 15).Value
With Workbooks("FY12-Q3 Data Tables.xlsx").Sheets("TOTAL RESPONDENTS").Columns(1)
Set c = .Find("[" & rCell & "C" & "]", LookIn:=xlValues)
Set c = .Find(rCell.Offset(0, 1).Value, After:=c)
Set c = .Find("Top 2 (NET)", After:=c)
End With
rCell.Offset(0, 20).Value = c.Offset(, 14).Value
rCell.Offset(0, 29).Value = c.Offset(, 3).Value
rCell.Offset(0, 30).Value = c.Offset(, 12).Value
rCell.Offset(0, 31).Value = c.Offset(, 15).Value
End If
Next
End Sub



Thanks in advance
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

Forum statistics

Threads
1,215,767
Messages
6,126,778
Members
449,336
Latest member
p17tootie

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