Trouble with Counter to Increment Through an Array - What gives?

CatLadee

New Member
Joined
Sep 7, 2018
Messages
29
Can one of you smart people please give me a hint about why I am unable to increment through one range to move it to another location with my current code? The current counter just gives the last variable in the loop for all of the new range's slots. The comma'd out counter says type mismatch. in a jam - please help. Thank you thank you thank you in advance! - CatLadee


With Worksheets("Brackets").Range("Anchor_R1")
Set rng = Range(.Offset(1, 10), .Offset(1, 10).End(xlDown))


r = 1

For Each cell In rng
Range(.Offset(12, 2), .Offset(12, 3).End(xlDown)) = rng(r)
r = r + 1 'rng(r) = rng(r) + 1
Next cell
End With
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
You loop through each cell in the source range, but the destination range never changes.

I'm not sure what your goal is, but this...
Range(.Offset(12, 2), .Offset(12, 3).End(xlDown))
...never changes in your code. You write each cell value from the source range to the same destination.
 
Upvote 0
Thanks! Your reply got me thinking along and right track and the below worked. All the best to you!

Code:
 With Worksheets("Brackets").Range("Anchor_R1")        Set rng = Range(.Offset(1, 9), .Offset(1, 9).End(xlDown))
        Set rng2 = Range(.Offset(12, 0), .Offset(12, 1).End(xlDown))
            
        r = 1
    
        For Each cell In rng
            rng2(r) = rng(r)
            r = r + 1
    
        Next cell
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,244
Members
452,622
Latest member
Laura_PinksBTHFT

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