What am I doing wrong with my code below? I am trying to name a range of data that is highlighted in excel and be able to call it in the VBA code and paste it, transpose it, etc
Edit: after reading the comments: Here is a simpler way to copy a range of cells, then pasting special (values) to somewhere else. I obtained this code my recording a macro entirely.
Sub Macro1()
Range("A1:C3").Select
Selection.Copy
Cells(10,"D").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
End Sub
If you meant to copy the D10 range to whatever activecell is, then Change
Cells(10, "D").Select
to
Cells(10, "D").copy
You also need to specify what do you want to SPECIALLY PASTE (values? format?) So your full code should be like
Sub routine()
Dim rng As Range
Set rng = ActiveCell.CurrentRegion
Cells(10, "D").Copy
rng.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False 'This will only paste values
Application.CutCopyMode = False
End Sub