ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Create a Macro with Starting Cell as a Variable (https://www.excelbanter.com/excel-programming/295097-create-macro-starting-cell-variable.html)

Linda M.[_2_]

Create a Macro with Starting Cell as a Variable
 
I want to create a macro with the starting cell as a
variable, not a fixed value.
I want the macro to:

1. Start in a cell location (this cell changes with each
run).
2. Go to a named range.
3. Copy the named range.
4. Return to the starting cell.
5. Paste the named range.

I have not been successful at making the starting cell a
variable.

Ron de Bruin

Create a Macro with Starting Cell as a Variable
 
Hi Linda

Try this to copy the range to the activecell

Range("named range").Copy ActiveCell


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Linda M." wrote in message ...
I want to create a macro with the starting cell as a
variable, not a fixed value.
I want the macro to:

1. Start in a cell location (this cell changes with each
run).
2. Go to a named range.
3. Copy the named range.
4. Return to the starting cell.
5. Paste the named range.

I have not been successful at making the starting cell a
variable.




Juan Pablo González

Create a Macro with Starting Cell as a Variable
 
Linda M. wrote:
I want to create a macro with the starting cell as a
variable, not a fixed value.
I want the macro to:

1. Start in a cell location (this cell changes with each
run).
2. Go to a named range.
3. Copy the named range.
4. Return to the starting cell.
5. Paste the named range.

I have not been successful at making the starting cell a
variable.


Try this

Sub CopyNamedRange()
Range("RangeNameHere").Copy ActiveCell
End Sub

--
Regards,

Juan Pablo González




All times are GMT +1. The time now is 03:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com