CommandButton help

LostinVA

New Member
Joined
May 23, 2018
Messages
43
Hi everyone. I'm a complete noob so appreciate any help you all can provide. I'm trying to edit the below code so that when a CommandButton is clicked, it allows me to copy row data from a different tab "QRR Template" and paste/transpose the data on the tab where the button is located. I'd like the data to begin pasting on cell B7.


Private Sub CommandButton1_Click()
Sheets("QRR Template").Range("B6:AK1000").Copy
Range("B" & Columns.Count).End(xlUp).Offset(1).PasteSpecial Transpose:=True
End Sub

The above is copying and pasting/transposing the data, but it's not beginning the paste on B7 and there are wonky #REF ! and other values being pasted beginning in Column AQ.

Appreciate any help you all can provide!
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Try this:

Code:
Option Explicit


Private Sub CommandButton1_Click()
Sheets("QRR Template").Range("B6:AK1000").Copy
If ActiveSheet.Range("B7") = "" Then
ActiveSheet.Range("B7").PasteSpecial Transpose:=True
Else:
ActiveSheet.Range("B" & Columns.Count).End(xlUp).Offset(1).PasteSpecial Transpose:=True
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,159
Members
453,021
Latest member
Justyna P

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