Loop with Range that requires offset

Dani_LobP

Board Regular
Joined
Aug 16, 2019
Messages
134
Office Version
  1. 365
Platform
  1. Windows
Hi all,

Hope someone can help, im trying to make a loop that relies on a range, which should be changing every cycle.

VBA Code:
Range("Q244").Select
Do Until ActiveCell.Offset(0, -1) = ""
    Set RangeLoop = Range("C8:C25")
        With ActiveCell
            RangeLoop.Copy
            ActiveCell.PasteSpecial xlPasteValues
        End With
        ActiveCell.Offset(18, 0).Select
        Set RangeLoop = RangeLoop.Offset(22, 0)
Loop

So if range i want to paste is from C8:C25 ... in theory when i set offset 22,0, the new range should be C29:C46 ... but won´t work and will paste again same initial range..

Hope it makes sense.

Thanks in advance!
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Not entirely sure what you are trying to do, but does this work
VBA Code:
Range("Q244").Select
Set RangeLoop = Range("C8:C25")
Do Until ActiveCell.Offset(0, -1) = ""
        With ActiveCell
            RangeLoop.Copy
            ActiveCell.PasteSpecial xlPasteValues
        End With
        ActiveCell.Offset(18, 0).Select
        Set RangeLoop = RangeLoop.Offset(22, 0)
Loop
 
Upvote 0
Not entirely sure what you are trying to do, but does this work
VBA Code:
Range("Q244").Select
Set RangeLoop = Range("C8:C25")
Do Until ActiveCell.Offset(0, -1) = ""
        With ActiveCell
            RangeLoop.Copy
            ActiveCell.PasteSpecial xlPasteValues
        End With
        ActiveCell.Offset(18, 0).Select
        Set RangeLoop = RangeLoop.Offset(22, 0)
Loop


ahh ofc... i had the range set inside the loop so doesnt matter what would change later that it would reset.. right?
feel silly now hehe
Thanks for the help!
 
Upvote 0

Forum statistics

Threads
1,224,885
Messages
6,181,577
Members
453,055
Latest member
cope7895

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