No named ranges are working anymore

CH64

New Member
Joined
Aug 30, 2011
Messages
8
I have a large workbook with several sheets, and a hundred or so single cells defined as named ranges so that I can easily reference them from VBA. In the beginning this worked fine, but for some reason it stopped working. Suddenly I'm not able to reference the named ranges anymore, the result is just empty.

If I open a new blank workbook and use the following simple example it works as supposed, the value of the single cell with the range name "testrange" is displayed in a message box. But if I do the same thing in my existing workbook the message box is empty.

Sub Test()
Dim var As String
var = Range("testrange")
MsgBox (var)
End Sub

To me it seems as if I've somehow managed to break all named ranges in my existing workbook. I will be very grateful for all ideas about what might have caused this.
 
Yes, still the 1004 error. It seems as if I can't refer to the named ranges by name in the VBA code, but your code that just looped through all of them works. Very strange...
 
Upvote 0

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
That worked perfectly, thank you very much!

I just created a new workbook and right clicked each sheet in the old workbook and moved it to the new one. After that it started to work like before.
 
Upvote 0

Forum statistics

Threads
1,224,551
Messages
6,179,476
Members
452,915
Latest member
hannnahheileen

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