Reputation: 11
I recorded the following to transpose a vertical set of cells to a range displaced two cells to the right from the start of the original range.
Sub Macro4()
'
' Macro4 Macro
'
' Keyboard Shortcut: Option+Cmd+u
'
Range("A105:A115").Select
Selection.Copy
Range("C105").Select
Selection.PasteSpecial Paste:=xlAll, Operation:=xlNone, SkipBlanks:=False _
, Transpose:=True
ActiveWindow.SmallScroll Down:=6
Range("A116").Select
End Sub
Now, I want to run the macro to perform this operation relative to other manually highlighted cells. How can I edit the code to do that? Thanks.
Upvotes: 1
Views: 110
Reputation: 19737
Try this:
Dim rng As Range
If TypeName(Selection) = "Range" Then
Set rng = Selection
rng.Copy
rng.Offset(0, 2).Resize(1, 1).PasteSpecial xlPasteAll, , , True
End If
HTH
Upvotes: 1