View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
DonT
 
Posts: n/a
Default Problem with paste

I've just started trying to learn Visual Basic so this is alittle above my
skill level
I need to be able to select the starting cell on the 1st sheet "customer's
name
and then paste it on the 2nd sheet on a cell of my chosing

Private Sub CommandButton1_Click()

Dim Msg, Style, Title, Response
Msg = "Do you want to move a customer to the 2nd worksheet ?"
Style = vbYesNo + vbQuestion
Title = "Move customer command!!"
Response = MsgBox(Msg, Style, Title)


If Response = vbYes Then
'select the worksheet to be active
Sheets("Sheet1").Activate
'select the customer to be moved
Set startingcell = Application.InputBox(prompt:="Select a customer",
Left:=150, Top:=5, Type:=8)
'this copy's the customer's name in the selected cell
startingcell.Copy
'move to sheet 2
Sheets("sheet2").Activate
'select where to paste the customer
Set endingcell = Application.InputBox(prompt:="Select a cell",
Left:=150, Top:=5, Type:=8)

'this will paste the customer in the current cell
endingcell.Paste

When I run this I get a run time error "438"
object doesn't support this property or method

Thank you
Don