Copy and paste and move down a sheet, iterating until the end

jollyreaper

New Member
Joined
Mar 10, 2019
Messages
1
I'm new to VBA so I'm probably mucking up the syntax here. So here's what the data looks like.

There's chunks of information running down column C. They come in 92 line chunks and so I know the header name that defines the chunk will be in c2, c2+92, c2+92+92, etc. I just need to copy paste special values one cell down and to the right. For the first chunk, it's copy C2, move down and to the left to B3, paste special values, then repeat on down the sheet.

This is the code I wrote to do it and I think the basic logic of what I'm trying to do makes sense but I'm making a hash of the actual code.

I'm trying to setup a loop so that I can specify the active cell with variables and then iterate down through the data.

Where, oh where am I going wrong?

Thanks!

'Set cell to B3 to start script -- it will then move up and right to copy and down and left to paste
Range("B3").Select
'Set variable we're using to move down the cells b is for column b, c for column c
Dim a, b As Integer
c = 2
b = 3


'Iterate through this 65k times until we're past the 64k at the bottom
Do While c < 65000


'Setting for the game name in C, aka bartop, moving up to the right to copy
ActiveCell.Offset(c, 1).Range("C2").Select
Selection.Copy
'Move down to the left and copy
ActiveCell.Offset(b, -1).Range("B3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False


'Incriment counters and loop back to beginning
c = c + 92
b = b + 92
Loop
End Sub
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Hi & welcome to MrExcel
How about
Code:
Sub jollyreaper()
   Dim i As Long
   
   For i = 2 To Range("C" & Rows.Count).End(xlUp).Row Step 92
      Cells(i + 1, 2).Value = Cells(i, 3).Value
   Next i
End Sub
 
Upvote 0

Forum statistics

Threads
1,203,535
Messages
6,055,964
Members
444,839
Latest member
laurajames

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