VBA Code help - Copy Title as Variable then paste else where

Lambrix

Board Regular
Joined
Jun 29, 2012
Messages
62
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
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.

Forum statistics

Threads
1,215,360
Messages
6,124,493
Members
449,166
Latest member
hokjock

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