Hi ... I'm new to this forum - thanks in advance for taking the time to help me with this ... I'm creating a Macro to paste a series of formulas from a template in hidden rows above to cells further down in the same worksheet. My code works fine if I set an absolute range as the Destination - here's a portion of it:
Sub TimelineRow150()
Dim TimelineMatch As Integer, ProjectPlan As Object
TimelineMatch = ActiveCell.Offset(0, -1).Value
If TimelineMatch = 26 Then
Range("E26:AQ28").Select
Selection.Copy
Range("E150:AQ152").Select
ActiveSheet.Paste
ElseIf TimelineMatch = 30 Then
Range("E30:AQ32").Select
Selection.Copy
Range("E150:AQ152").Select
ActiveSheet.Paste
I'd like to be able to copy and paste this code to run it multiple times in the same worksheet, (the TimelineMatch variable actually has 26 different options). Is there a way to replace the
[Range("E150:AQ152").Select] portion of the code with a range that is relative to the Active Cell? (I'd instruct users that cell E be the Active cell before running the Macro, and E to AQ is still the range I need the copied data to appear.) I've tried using ActiveCell.Offset, but I keep getting an error of Method 'Range of Object' _Global' failed.
Would love any insights you can provide. Many thanks!
Ann
Sub TimelineRow150()
Dim TimelineMatch As Integer, ProjectPlan As Object
TimelineMatch = ActiveCell.Offset(0, -1).Value
If TimelineMatch = 26 Then
Range("E26:AQ28").Select
Selection.Copy
Range("E150:AQ152").Select
ActiveSheet.Paste
ElseIf TimelineMatch = 30 Then
Range("E30:AQ32").Select
Selection.Copy
Range("E150:AQ152").Select
ActiveSheet.Paste
I'd like to be able to copy and paste this code to run it multiple times in the same worksheet, (the TimelineMatch variable actually has 26 different options). Is there a way to replace the
[Range("E150:AQ152").Select] portion of the code with a range that is relative to the Active Cell? (I'd instruct users that cell E be the Active cell before running the Macro, and E to AQ is still the range I need the copied data to appear.) I've tried using ActiveCell.Offset, but I keep getting an error of Method 'Range of Object' _Global' failed.
Would love any insights you can provide. Many thanks!
Ann