C
Chris Akens
I have finally done all the coding for my macro and I am just trying
to to tidy it up a little bit. I have two issues...
1) When I run my macro it will copy the data and then switch (select?)
to the sheet it is pasting to. I would like to be done in the
backround. I have played around with AutoUpdate = False, but with no
success. I am just not sure on how to accomplish this.
2) After the copy, I would like excel to automatically clear a range
of cells (not the copied cells, as they are calculations from a
different range). I am presently researching this, but have no idea on
how to do it.
Thank You for all of your help!
Chris
Here is my code....
Sub Player1()
Dim r As Integer
Dim c As Integer
Dim x As Integer
r = Sheets("hidden").Range("a1")
c = 1
x = 5
If IsEmpty(Sheets("ScoreCard").Range("c14")) Then
Else
If IsEmpty(Sheets("Player1").Cells(r, c)) Then
Sheets("ScoreCard").Range("AA21:AA25").Select
Selection.Copy
Sheets("Player1").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("Player1").Select
Cells(r, x).Select
Selection.PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=True
With Sheets("hidden").Range("A1")
.Value = .Value + 1
If .Value = 31 Then .Value = 1
End With
Else
With Sheets("hidden").Range("A1")
.Value = .Value + 1
If .Value = 31 Then .Value = 1
End With
Sheets("ScoreCard").Range("AA21:AA25").Select
Selection.Copy
Sheets("Player1").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("Player1").Select
Cells(r, x).Select
Selection.PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=True
End If
End If
End Sub
to to tidy it up a little bit. I have two issues...
1) When I run my macro it will copy the data and then switch (select?)
to the sheet it is pasting to. I would like to be done in the
backround. I have played around with AutoUpdate = False, but with no
success. I am just not sure on how to accomplish this.
2) After the copy, I would like excel to automatically clear a range
of cells (not the copied cells, as they are calculations from a
different range). I am presently researching this, but have no idea on
how to do it.
Thank You for all of your help!
Chris
Here is my code....
Sub Player1()
Dim r As Integer
Dim c As Integer
Dim x As Integer
r = Sheets("hidden").Range("a1")
c = 1
x = 5
If IsEmpty(Sheets("ScoreCard").Range("c14")) Then
Else
If IsEmpty(Sheets("Player1").Cells(r, c)) Then
Sheets("ScoreCard").Range("AA21:AA25").Select
Selection.Copy
Sheets("Player1").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("Player1").Select
Cells(r, x).Select
Selection.PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=True
With Sheets("hidden").Range("A1")
.Value = .Value + 1
If .Value = 31 Then .Value = 1
End With
Else
With Sheets("hidden").Range("A1")
.Value = .Value + 1
If .Value = 31 Then .Value = 1
End With
Sheets("ScoreCard").Range("AA21:AA25").Select
Selection.Copy
Sheets("Player1").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("Player1").Select
Cells(r, x).Select
Selection.PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=True
End If
End If
End Sub