Hi all
Working on someone else's macros/ worksheets which is a real pain.
I just can't seem to get a macro to just copy a cell!! Seems stupid but it won't have it. I've tried on another made up sheet and it worked no problem. Can anyone think of something that is wrong with this sheet that is stopped it selecting a cell. I get runtime error 1004 activate method of range class failed every time I try to select range("e4").select. I've tried activating it, using activeworkbook.activesheet things that were suggested in other helps but to no avail
Here is the bit of code.
Dim labelnumber
Windows("basefilecolourPIP2.xls").Activate
Sheets("data").Select
Range("e3").Copy
Range("e4").select
Selection.PasteSpecial Paste:=xlValues
labelnumber = Range("E4").Value
MsgBox labelnumber
ActiveWindow.ActivateNext
Range("b6") = labelnumber
x = MsgBox("Is this the correct label number? " & labelnumber & Chr(13) & "Click OK to print or cancel to exit", vbOKCancel)
If x = vbOK Then
Selection.PrintOut
Else
Exit Sub
End If
Any help appreciated!
Cath ray:
Working on someone else's macros/ worksheets which is a real pain.
I just can't seem to get a macro to just copy a cell!! Seems stupid but it won't have it. I've tried on another made up sheet and it worked no problem. Can anyone think of something that is wrong with this sheet that is stopped it selecting a cell. I get runtime error 1004 activate method of range class failed every time I try to select range("e4").select. I've tried activating it, using activeworkbook.activesheet things that were suggested in other helps but to no avail
Here is the bit of code.
Dim labelnumber
Windows("basefilecolourPIP2.xls").Activate
Sheets("data").Select
Range("e3").Copy
Range("e4").select
Selection.PasteSpecial Paste:=xlValues
labelnumber = Range("E4").Value
MsgBox labelnumber
ActiveWindow.ActivateNext
Range("b6") = labelnumber
x = MsgBox("Is this the correct label number? " & labelnumber & Chr(13) & "Click OK to print or cancel to exit", vbOKCancel)
If x = vbOK Then
Selection.PrintOut
Else
Exit Sub
End If
Any help appreciated!
Cath ray: