W
Wade
Please help,
I am trying to build a macro that copies the first name on the list,
pastes this to a locaiton, pauses to allow for other calculations to
occur and then moves to the next name on the list. The past location
will be the same for each name on the list.
The example I'm working on is as follows
A B C
1 Smith
2 Mike
3 Sally
4 END
I have built the following macro that should copy "Smith" from A1 to
C2, pause, then copy "Mike" from A2 to C2, pause and finally copy
"Sally" from A3 to C2 and pause. When the macro get to "END" at A4 I
want it to terminate.
The macro I've put together is below but is not working for me.
Thanks,
Wade.
Sub Loop_Macro()
'
'
Application.ScreenUpdating = False
Dim rg2 As Range
Set rg2 = Range("a1")
Dim dest As Range
Set dest = Range("$C$2")
Do Until rg2.Value = "END"
If rg2.Value = dest.Value Then rg2 = rg2.Offset(0, 1)
Selection.Copy
'If rg1 > "11" Then dest.Select
dest.Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
newhour = Hour(Now())
newminute = Minute(Now())
newsecond = Second(Now()) + 1
waittime = TimeSerial(newhour, newminute, newsecond)
Application.Wait waittime
Loop
Application.ScreenUpdating = True
End Sub
I am trying to build a macro that copies the first name on the list,
pastes this to a locaiton, pauses to allow for other calculations to
occur and then moves to the next name on the list. The past location
will be the same for each name on the list.
The example I'm working on is as follows
A B C
1 Smith
2 Mike
3 Sally
4 END
I have built the following macro that should copy "Smith" from A1 to
C2, pause, then copy "Mike" from A2 to C2, pause and finally copy
"Sally" from A3 to C2 and pause. When the macro get to "END" at A4 I
want it to terminate.
The macro I've put together is below but is not working for me.
Thanks,
Wade.
Sub Loop_Macro()
'
'
Application.ScreenUpdating = False
Dim rg2 As Range
Set rg2 = Range("a1")
Dim dest As Range
Set dest = Range("$C$2")
Do Until rg2.Value = "END"
If rg2.Value = dest.Value Then rg2 = rg2.Offset(0, 1)
Selection.Copy
'If rg1 > "11" Then dest.Select
dest.Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
newhour = Hour(Now())
newminute = Minute(Now())
newsecond = Second(Now()) + 1
waittime = TimeSerial(newhour, newminute, newsecond)
Application.Wait waittime
Loop
Application.ScreenUpdating = True
End Sub