Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default error - copy

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 789
Default error - copy

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

Ciara wrote:
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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default error - copy

it's saying object doesn't support this property or method?

" wrote:

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

Ciara wrote:
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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 789
Default error - copy

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

regards
Paul

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default error - copy

im still getting the error!!! any more ideas?

" wrote:

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

regards
Paul


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy between workbooks error Mike Fitz Excel Discussion (Misc queries) 2 July 24th 07 09:22 PM
Copy/Paste error Anthony Excel Worksheet Functions 2 February 7th 07 06:46 PM
Copy shortcut causes error KarenH Excel Worksheet Functions 0 October 14th 05 02:58 PM
Code Error - Run Time Error 5 (Disable Cut, Copy & Paste) Tim[_36_] Excel Programming 4 April 23rd 04 02:53 AM
Error in Copy/Paste Thierry zen Ruffinen Excel Programming 0 April 5th 04 09:46 AM


All times are GMT +1. The time now is 07:07 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"