rockchalk33
Board Regular
- Joined
- Jan 12, 2016
- Messages
- 111
Geniuses,
I am having a bit of trouble getting a piece of code to loop. I have a button that once clicked will do exactly this:
If Duplicate_Find Is Nothing Then
ActiveCell.Copy
ActiveCell.Offset(0, 2).Select
ActiveCell.PasteSpecial
ActiveCell.Offset(1, -2).Select
Else: ActiveCell.Offset(1, 0).Select
End If
I need this to start on Range ("A6") and loop until the first cell that is empty.
This is the code I tried:
Public Button1_Click()
Range ("A5").Select
Do Until IsEmpty (ActiveCell)
ActiveCell.Offset (1,0)
If Duplicate_Find Is Nothing Then
ActiveCell.Copy
ActiveCell.Offset(0, 2).Select
ActiveCell.PasteSpecial
ActiveCell.Offset(1, -2).Select
Else: ActiveCell.Offset(1, 0).Select
End If
Loop
End Sub
Every time I click Button_1 it automatically jumps down to the first empty cell and never copied any data over.
Any help would be appreciated, should be an easy fix.
Thanks all!
Devin
I am having a bit of trouble getting a piece of code to loop. I have a button that once clicked will do exactly this:
If Duplicate_Find Is Nothing Then
ActiveCell.Copy
ActiveCell.Offset(0, 2).Select
ActiveCell.PasteSpecial
ActiveCell.Offset(1, -2).Select
Else: ActiveCell.Offset(1, 0).Select
End If
I need this to start on Range ("A6") and loop until the first cell that is empty.
This is the code I tried:
Public Button1_Click()
Range ("A5").Select
Do Until IsEmpty (ActiveCell)
ActiveCell.Offset (1,0)
If Duplicate_Find Is Nothing Then
ActiveCell.Copy
ActiveCell.Offset(0, 2).Select
ActiveCell.PasteSpecial
ActiveCell.Offset(1, -2).Select
Else: ActiveCell.Offset(1, 0).Select
End If
Loop
End Sub
Every time I click Button_1 it automatically jumps down to the first empty cell and never copied any data over.
Any help would be appreciated, should be an easy fix.
Thanks all!
Devin