ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy named range contents to activecell position (https://www.excelbanter.com/excel-programming/315038-copy-named-range-contents-activecell-position.html)

Neal

Copy named range contents to activecell position
 
Hi


I have a dynamic named range "Shift1". I would appreciate some code that I
can assign to a button that will copy the contents of the named range to the
active cell position.

TIA

Dale Preuss[_2_]

Copy named range contents to activecell position
 
Neal,
Named ranges can be available to the entire workbook or they can be
worksheet specific.

If the name is at the workbook level:
Sub Shift1()
ActiveCell.Value = Range("rngShift1").Value
End Sub

If it is worksheet specific, this is prefered:
Sub Shift1()
ActiveCell.Value = Worksheets("Sheet 1").Range("rngShift1").Value
End Sub

Dale Preuss

"Neal" wrote:

Hi


I have a dynamic named range "Shift1". I would appreciate some code that I
can assign to a button that will copy the contents of the named range to the
active cell position.

TIA


Tom Ogilvy

Copy named range contents to activecell position
 
Private Sub CommandButton1_Click()
Range("Shift1").copy Destination:=ActiveCell
End Sub

--
Regards,
Tom Ogilvy

"Neal" wrote in message
...
Hi


I have a dynamic named range "Shift1". I would appreciate some code that I
can assign to a button that will copy the contents of the named range to

the
active cell position.

TIA





All times are GMT +1. The time now is 02:14 AM.

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