S
smandula
I can indepently get Trace to work, and Copyrange to print one line at a
time.
However, I can not both to work in conjunction with each other.
wht happens, is the a1..b1 rows, pause for 3 sec and then goes down one row
to a2..b2, pauses for two seconds, and then copies to e1..f1.
Here is the problem.
I now want to copy from e1..f1 to e5..f5 and loop until there is a blank
line
in column A,B
---------------------------------------------------
Public NextTime As Date
Sub Trace()
Sheet1.Range("A1").Select
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 3
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime
Call LoopOn
End Sub
Sub LoopOn()
ActiveCell.Offset(1, 0).Select
Range("E1").Value = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
Range("F1").Value = ActiveCell.Value
Call FindNum
NextTime = Now + TimeValue("00:00:02")
Application.OnTime NextTime, "LoopOn"
If Range("E1").Value = "" Then
Call LoopOff
End If
End Sub
Sub FindNum()
Range("A1").Activate
Do Until ActiveCell.Value = " "
If ActiveCell.Value = Range("E1").Value Then
Exit Sub
End If
ActiveCell.Offset(1, 0).Activate
Loop
'Call CopyRange2
End Sub
Sub LoopOff()
Application.OnTime NextTime, "LoopOn", , False
End Sub
Sub CopyRange2()
Sheets("sheet1").Range("E5:F5").Select
'find your empty cell
Do Until ActiveCell.Formula = ""
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Formula = Range("E1:F1").Copy
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=
_
False, Transpose:=False
Application.CutCopyMode = True
End Sub
time.
However, I can not both to work in conjunction with each other.
wht happens, is the a1..b1 rows, pause for 3 sec and then goes down one row
to a2..b2, pauses for two seconds, and then copies to e1..f1.
Here is the problem.
I now want to copy from e1..f1 to e5..f5 and loop until there is a blank
line
in column A,B
---------------------------------------------------
Public NextTime As Date
Sub Trace()
Sheet1.Range("A1").Select
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 3
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime
Call LoopOn
End Sub
Sub LoopOn()
ActiveCell.Offset(1, 0).Select
Range("E1").Value = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
Range("F1").Value = ActiveCell.Value
Call FindNum
NextTime = Now + TimeValue("00:00:02")
Application.OnTime NextTime, "LoopOn"
If Range("E1").Value = "" Then
Call LoopOff
End If
End Sub
Sub FindNum()
Range("A1").Activate
Do Until ActiveCell.Value = " "
If ActiveCell.Value = Range("E1").Value Then
Exit Sub
End If
ActiveCell.Offset(1, 0).Activate
Loop
'Call CopyRange2
End Sub
Sub LoopOff()
Application.OnTime NextTime, "LoopOn", , False
End Sub
Sub CopyRange2()
Sheets("sheet1").Range("E5:F5").Select
'find your empty cell
Do Until ActiveCell.Formula = ""
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Formula = Range("E1:F1").Copy
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=
_
False, Transpose:=False
Application.CutCopyMode = True
End Sub