C
Chris Akens
I am trying to copy values from cells on sheet "scorecard" to page
"rounds", all the while increnting which row the data is copied to. So
far this is working well.
I am trying to come up with a piece of code to only paste to row 30,
and then once row 30 is reached, start overwriting at row 1. I cannot
seem to figure this out. So far here is my code, any and all help
would be greatly appreciated.
Sub testmacro()
Dim r As Integer
Dim c As Integer
Dim x As Integer
r = Sheets("hidden").Range("a1")
c = 1
x = 5
If IsEmpty(Sheets("Rounds").Cells(r, c)) Then
Sheets("ScoreCard").Range("AA21:AA25").Select
Selection.Copy
Sheets("Rounds").Select
Cells(r, c).Select
Selection.PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=True
Sheets("ScoreCard").Activate
Sheets("ScoreCard").Range("AD21:AD25").Select
Selection.Copy
Sheets("Rounds").Select
Cells(r, x).Select
Selection.PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=True
With Sheets("hidden").Range("A1")
.Value = .Value + 1
End With
Else
Sheets("ScoreCard").Range("AA21:AA25").Select
Selection.Copy
Sheets("Rounds").Select
Cells(r, c).Select
Selection.PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=True
Sheets("ScoreCard").Activate
Sheets("ScoreCard").Range("AD21:AD25").Select
Selection.Copy
Sheets("Rounds").Select
Cells(r, x).Select
Selection.PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=True
End If
End Sub
Thanks,
Chris
"rounds", all the while increnting which row the data is copied to. So
far this is working well.
I am trying to come up with a piece of code to only paste to row 30,
and then once row 30 is reached, start overwriting at row 1. I cannot
seem to figure this out. So far here is my code, any and all help
would be greatly appreciated.
Sub testmacro()
Dim r As Integer
Dim c As Integer
Dim x As Integer
r = Sheets("hidden").Range("a1")
c = 1
x = 5
If IsEmpty(Sheets("Rounds").Cells(r, c)) Then
Sheets("ScoreCard").Range("AA21:AA25").Select
Selection.Copy
Sheets("Rounds").Select
Cells(r, c).Select
Selection.PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=True
Sheets("ScoreCard").Activate
Sheets("ScoreCard").Range("AD21:AD25").Select
Selection.Copy
Sheets("Rounds").Select
Cells(r, x).Select
Selection.PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=True
With Sheets("hidden").Range("A1")
.Value = .Value + 1
End With
Else
Sheets("ScoreCard").Range("AA21:AA25").Select
Selection.Copy
Sheets("Rounds").Select
Cells(r, c).Select
Selection.PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=True
Sheets("ScoreCard").Activate
Sheets("ScoreCard").Range("AD21:AD25").Select
Selection.Copy
Sheets("Rounds").Select
Cells(r, x).Select
Selection.PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=True
End If
End Sub
Thanks,
Chris