Good morning,
I am trying to hone my VBA skills, but I can't seem to wrap my head around this key concept.
I would like to save the contents of a cell (It's a title) as a variable in a form of a string, then copy its contents into another cell.
Here is what the code I have put together, obivously incorrectly. Any ideas where I am going wrong?
Sub CopySelectRange()
Dim MyActiveCell As Range
Dim MyTitle As String
Set MyActiveCell = ActiveCell
Set MyTitle = ActiveCell.Offset(-1, 0)
'Copy & Range Selection
ActiveCell.Range("A1:L1").Select
Selection.Copy
Range("B20").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=True
'Activate Cell 17 Rows down from ActiveRange & Copy MyTitle contents
MyActiveCell.Offset(17, 0).Activate
ActiveCell = MyTitle
Application.CutCopyMode = False
I am trying to hone my VBA skills, but I can't seem to wrap my head around this key concept.
I would like to save the contents of a cell (It's a title) as a variable in a form of a string, then copy its contents into another cell.
Here is what the code I have put together, obivously incorrectly. Any ideas where I am going wrong?
Sub CopySelectRange()
Dim MyActiveCell As Range
Dim MyTitle As String
Set MyActiveCell = ActiveCell
Set MyTitle = ActiveCell.Offset(-1, 0)
'Copy & Range Selection
ActiveCell.Range("A1:L1").Select
Selection.Copy
Range("B20").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=True
'Activate Cell 17 Rows down from ActiveRange & Copy MyTitle contents
MyActiveCell.Offset(17, 0).Activate
ActiveCell = MyTitle
Application.CutCopyMode = False