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>
 

DebugGalpin

Board Regular
Joined
Jun 29, 2011
Messages
175
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
 

Forum statistics

Threads
1,082,586
Messages
5,366,476
Members
400,892
Latest member
lamarh755

Some videos you may like

This Week's Hot Topics

Top