Do Until loop not stopping

Gabotico

New Member
Joined
Aug 19, 2015
Messages
2
I have the following code for a Do Until, but it is not stopping at the given point. You Help will be greatly appreciated

Sub Macro6()
'
' Macro6 Macro
'


'
Dim LastRow As Long
LastRow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
Dim CurrentRow As Long
CurrentRow = ActiveCell.Row




Do Until Cells(CurrentRow, 1) = "End"

Range("C2:D5").Select
Selection.Copy
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
ActiveSheet.Paste

Loop



End Sub

I'm using it on a table like this:

ABCCD
REPORTACCOUNTSCC$
REPORT110001formula
REPORT12formula
REPORT13formula
REPORT14formula
REPORT110001
REPORT1
REPORT1
REPORT1
REPORT110002
REPORT1
REPORT1
REPORT1
REPORT110005
REPORT1
REPORT1
REPORT1
REPORT1
End

<tbody>
</tbody>




<tbody>
</tbody>
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
CurrentRow = ActiveCell.Row
Do Until Cells(CurrentRow, 1) = "End"
Loop

So say you start and declare CurrentRow = ActiveCell.Row so lets say CurrentRow = 1
After you start the do until after the
first loop CurrentRow =1
second loop CurrentRow = 1
third loop CurrentRow = 1

and so on and so forth as you don't redeclare CurrentRow in the loops it stays as 1
 
Upvote 0

Forum statistics

Threads
1,214,780
Messages
6,121,522
Members
449,037
Latest member
tmmotairi

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