I have created a macro to copy data that is inserted into one workheet into a different worksheet using the pastespecial command to only insert the values. The macro also takes into account if there is already data in that column (cells in that column); if so, it then moves one column to right and checks it for data.
My problem is this; I have had it working before (i believe when i was using 2003) but now it is not working. It appears to copy the data correctly and check the columns on the other worksheet but it never pastes the data. Also, if I try to run it more than once, I receive the ever annoying message of "Run-time error '1004': Method Range' of object '_Global' failed."
Like I said, I've had this working before, but I wouldn't think that 2007 would cause it to not work because I had other people using 2007 run it before. Below is the macro, and yes just to confirm, there is a sheet called %s. Thanks in advance for any help.
Sub PasteSpecial()
Dim loopvar As Boolean
Dim CELL As Integer
Dim Cellletter As String
loopvar = True
CELL = 1
Sheets("% s").Activate
Range("A1:A49").Select
Selection.Copy
Sheets("Peak Statistics").Activate
Range("A9").Activate
Do
If IsEmpty(ActiveCell.Offset(0, CELL)) Then
loopvar = False
Else
CELL = CELL + 1
End If
Loop While (loopvar = True)
CELL = CELL + 65
Cellletter = Chr(CELL) & "9"
Range(Cellletter).Activate
ActiveCell.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub
Bookmarks