error - copy

G

Guest

can anybody see the problem with this code - iv highlighted where i get an
error message

Private Sub CommandButton1_Click()
Dim pronumber As String
Message1 = "Please enter Project Number."
Title1 = "INPUT BOX"
Default1 = Range("A2")
Message2 = "Do you wish to add KPI2 Data"
Style1 = vbYesNo
pronumber = InputBox(Message1, Title1, Default1)
With Worksheets("KPI1").Range("a:a")
Set c = .Find(pronumber, LookIn:=xlValues)
If Not c Is Nothing Then
c.Select
Range(ActiveCell, ActiveCell.Offset(0, 12)).Copy
ActiveSheet.Paste Destination:=Worksheets("GraphData").Range("A2")
Set c = Nothing
Range("A1").Select
Else
MsgBox ("This project number does not exist")
End If
End With
Reply1 = MsgBox(Message2, Style1)
If Reply1 = vbYes Then
Sheets("KPI2").Select
With Worksheets("KPI2").Range("a:a")
Set c = .Find(pronumber, LookIn:=xlValues)
If Not c Is Nothing Then
c.Select
Range(ActiveCell, ActiveCell.Offset(0, 12)).Copy 'errorr*****
ActiveSheet.Paste Destination:=Worksheets("GraphData").Range("A3")
Else
MsgBox ("This project number does not exist")
End If
End With
Else
End If
changechart
End Sub
 
P

paul.robinson

Hi
Try putting
Application.xlCutCopyMode = False

between the two copy commands e.g. before Reply1 = ...

this clears the clipboard. Used to work for me in Excel 2000.

regards
Paul
 
P

paul.robinson

Sorry
I'm rubbish at checking...Should be
Application.CutCopyMode = false

regards
Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top