Help adapting macro for my C&P needs

capek

New Member
Joined
Dec 9, 2020
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hi! Hoping this is a simple question to have answered. New enough to using Excel at this level that I'm stumped on my own. What I want to do is automate the process of copying three rows of data from outside excel, then paste and match destination formatting into excel, then transpose those three rows into the three empty columns of a row, as seen in the attached screenshot, and then do that with new data into each row of the worksheet:

C&Pmacrohelp.JPG


I recorded a macro of the process, but the problem is that it's stuck with the ranges used when recording the macro, and I have no idea how to adapt it so that I can paste and transpose new data into each row. Basically, I want to be able to select cell C3 to get that data into row 2, then select C4 to get the next data into row 3, etc etc. Here is the macro I recorded, trying to achieve this purpose:

VBA Code:
Sub ADCP()
'
' ADCP Macro
'
' Keyboard Shortcut: Ctrl+l
'
    ActiveSheet.PasteSpecial Format:="HTML", Link:=False, DisplayAsIcon:= _
        False, NoHTMLFormatting:=True
    Selection.Copy
    Range("B107").Select
    Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=True
    Range("B108:B110").Select
    Application.CutCopyMode = False
    Selection.ClearContents
    Range("B109").Select
End Sub

That macro records me selecting the equivalent of cell C3, clicking the Paste and Match Destination Formatting ribbon shortcut, selecting cell C2, clicking the Paste and Transpose ribbon shortcut, then selecting cells C3:5 and deleting the three pasted in rows, and finally selecting cell C4, to start with the next set of data to be pasted in. But I'm hoping there's an easy way to adapt the macro so that it's not limited to the range I used when recording the macro, but instead is actually functional to paste and transpose row after row of unique data into the correct columns.

Thanks so much for the help, and please let me know if I can provide any clarification.
 

Some videos you may like

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

capek

New Member
Joined
Dec 9, 2020
Messages
2
Office Version
  1. 365
Platform
  1. Windows
bumping to see if anyone has any ideas.
 

Watch MrExcel Video

Forum statistics

Threads
1,127,326
Messages
5,624,018
Members
416,006
Latest member
PCaffrey

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
Top