VBA Setting a range variable to a range typed in a cell

nmbc99

New Member
Joined
Apr 28, 2022
Messages
19
Office Version
  1. 365
Platform
  1. Windows
Hello, is it possible to set a range variable to a range that is typed into a cell? For example:

VBA Code:
Dim rng As Range

Set rng = Sheet1.Cells(1,1).Value

Cell A1's value = $B$1:$H$32

The above code doesn't work, hence why I am asking. Am I setting it up wrong? Or is this not possible?

I originally had rng setup to be something the user selects, but I'm trying to make it something the user only has to select 1 time, rather than every time this particular code is ran. This code automatically runs if it sees a change in specific cells.
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Try your Set line this way...
VBA Code:
Set rng = Range(Sheet1.Cells(1, 1).Value)
 
Upvote 0
Solution

Forum statistics

Threads
1,214,422
Messages
6,119,395
Members
448,891
Latest member
tpierce

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