close

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 quot;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 = quot;Do you want to move a customer to the 2nd worksheet ?quot;
Style = vbYesNo vbQuestion
Title = quot;Move customer command!!quot;
Response = MsgBox(Msg, Style, Title)If Response = vbYes Then
'select the worksheet to be active
Sheets(quot;Sheet1quot;).Activate
'select the customer to be moved
Set startingcell = Application.InputBox(prompt:=quot;Select a customerquot;,
Left:=150, Top:=5, Type:=8)
'this copy's the customer's name in the selected cell
startingcell.Copy
'move to sheet 2
Sheets(quot;sheet2quot;).Activate
'select where to paste the customer
Set endingcell = Application.InputBox(prompt:=quot;Select a cellquot;,
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 quot;438quot;
object doesn't support this property or method

Thank you
Don

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()