Creating a named range from cell values

david porter cpl

New Member
Joined
Mar 11, 2022
Messages
4
Office Version
  1. 2016
Platform
  1. Windows
I need a solution on how to create a named range based upon cell values. The cell values are variable, and the sheets on which the named ranges need to be created are hidden from the end user, hence the need to automate it. I've had some success with the actual name of the range as per a cells value, but I'm struggling to set a cell value as the array of cells in which to create the range itself. Any help would be greatly appreciated. Many thanks.
 

Attachments

  • Capture.JPG
    Capture.JPG
    15.8 KB · Views: 13

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
try this:
VBA Code:
Sub test()
Dim rst As String
Dim Sht As String
Dim nam As String

Dim tt As Range
Sht = Range("c2")
rst = Range("c3")
nam = Range("c4")
Set tt = Worksheets(Sht).Range(rst)
    ActiveWorkbook.Names.Add _
        Name:=nam, _
        RefersTo:=tt
        
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,611
Messages
6,120,509
Members
448,967
Latest member
screechyboy79

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