Transpose data - offset data one column

LostinVA

New Member
Joined
May 23, 2018
Messages
43
Hi all -

I have the below code to copy a set of row data from one tab and paste/transpose when a Command Button is clicked on a second tab. How do I edit this so that every time the Command Button is clicked, the data is pasted to the right on the first blank row? Currently, when it's clicked a second time it pastes below the already pasted data.

What it does now:

Copied as: aaaaa
Pasted as: a
a
a
a
a

When I click the button again, it copies and pastes as follows:

a
a
a
a
a
a
a
a
a
a

I would like it to perform as follows instead:

aa
aa
aa
aa
aa

Hope that makes sense!

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

Appreciate any help!
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
What it does now:

Copied as: aaaaa
Pasted as: a
a
a
a
a
:confused: Above, you show a single column of data (after Transposing) that you say you want to copy next to any previously copied columns, but your code...

Sheets("QRR Template").Range("B6:AK1000").Copy

shows you are copying/pasting a block of 995 rows by 36 columns (before Transposing). So from your code, it looks like you will be pasting 995 columns of (Transposed) data with each button press. So what exactly are you trying to do (please clarify)?
 
Upvote 0
Hi Rick, thanks for your reply. Sorry, I was just using that as an example. Basically, the amount of data rows to be copied and pasted is unknown (I created a large range to ensure all possible data is captured).. it depends on user input on the first tab. So when the user is done entering their data, they hit the Command Button and all of their data is copied and pasted/transposed on the second tab. If they hit the button again, I'd like all of that data to paste in the first column to the right of the data that was previously pasted/transposed. As the code is now, if the button is pressed again, the data pastes/transposes underneath the previously pasted/transposed data.

Hopefully that makes sense.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,169
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