VBA Do while loop problem

1021557

Board Regular
Joined
Dec 14, 2007
Messages
54
Hi, I have a sheet where I want the contents of row G (where it has contents) to copy itself to the corresponding row in column A until the code has gone right through column G. The first such item is in row 1383 column G and occurs randomly down the rest of the spreadsheet. I've tried writing this but it doesn't do anything. Any help very much appreciated

Here is the code:

Sub Loop1()

Application.Goto Reference:="R1383C1"

Do
ActiveCell.FormulaR1C1 = "=(RC[6])"
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveCell.Offset(0, 6).Select
Loop Until IsEmpty(ActiveCell.Offset(0, 6))
End Sub

Thanks
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
You shouldn't need a loop:

Code:
Sub test()
Range("A1383:A" & Range("G1383").End(xlDown).Row).Formula = "=G1383"
End Sub
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,213
Members
448,554
Latest member
Gleisner2

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