Command button logic

Vokes7791

New Member
Joined
Jun 20, 2012
Messages
10
Stuck again!
How do I go about repeating the below with range ("D5") to destination ("C6") as well as keeping the below.
Private Sub CommandButton1_Click()
With Range("d4")
.Copy Destination:=Sheets("Sheet1").Range("b6")
.ClearContents
End With
End Sub​
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Do you mean?

Rich (BB code):
Private Sub CommandButton1_Click()
    With Range("D4:C6")
        .Copy Destination:=Sheets("Sheet1").Range("B6")
        .ClearContents
    End With
End Sub
 
Upvote 0
thanks for your reply.
What i'm trying to do is send a vertical list ie. Last name (A1) first name (A2) Company (A3) into an horizontal list last name (A1) first name (B1) company (C1) on another sheet (Sheet2). The Code i posted works to tranfer (A1) on sheet1 to A1 on Sheet2, but I would also like to move to other information the same way. I was tryin elseif code but that was a non starter.
 
Upvote 0
Sorry, I misunderstood. Try Paste Special|Transpose:

Code:
Private Sub CommandButton1_Click()
    With Range("D4:D5")
        .Copy
        Sheets("Sheet1").Range("B6").PasteSpecial Paste:=xlPasteAll, Transpose:=True
        .ClearContents
    End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,203,174
Messages
6,053,928
Members
444,694
Latest member
JacquiDaly

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top