Loop ActiveCell.Offset Problems

adruss85

New Member
Joined
Mar 4, 2009
Messages
8
Hi,

I'm trying to get the active cell to Offset by ((i - 1) * LR, 0) for each iteration of my loop, until i = LR

i.e. I copy from "sheet 1" move to "JMP Data" sheet, selects B2, then offsets by 0 rows on first iteration, 8 on 2nd, then 16 on 3rd (when LR = 8) pasting after each iteration.

Here's the code:

Code:
    Dim i As Integer
        
    Do Until i = LR
    
        i = 1
        Sheets(ActiveSheet.Index + 1).Activate
        ActiveCell.Offset(1, 0).Select
        Range(Cells(ActiveCell.Row, ActiveCell.Column), Cells(ActiveCell.Row, ActiveCell.Column + LC)).Select
        Selection.Copy
        Sheets("JMP Data").Select
        [B]Range("B2").Select
        If i - 1 > 0 Then
        ActiveCell.Offset(LR * i, 0).Select
        Else
        End If
[/B]        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=True
        i = i + 1
    
    Loop

I tried using

Code:
ActiveCell.Offset((i - 1) *LR, 0 ).Select

Initially but that didnt work, so i moved to this If statement. This is the first IF statement and loop i've written so is most likey wrong! Any help would be appreciated!

Also, i'm sure the code is very big and clunky but if the solution could be for this code, rather than new one, it would help my learning process greatly.

Thanks!
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
I just solved my own problem!!!

The i = 1 should've been outside the Loop!

Sorry for wasting your time!
 
Upvote 0

Forum statistics

Threads
1,214,636
Messages
6,120,668
Members
448,977
Latest member
moonlight6

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