Import Excel Data Not Working With Dynamic Named Range

mrMozambique

Board Regular
Joined
Mar 9, 2005
Messages
97
Hi all. This may exist here already, but my searches have been futile so far. I have a dynamic named range (using offset) in an Excel file. When I try to import the data into Access, the dynamic range doesn't appear in the list of named ranges. If I change the range to a fixed area (=A$1$:AJ$:500$ or whatever), it works fine.

Does Access not recognize dynamic named ranges? What gives!?
 
To confirm what you've found, dynamic named ranges are not usable in queries.

Agree with Joe, create in VBA. Such as,
Code:
'I'm sure you can leave the sheet very hidden,
'but I think it needs to be unprotected to use
'current region. If you have set a scroll area
'you need to clear it first, too
 
'then again, if the sheet is hidden or very hidden,
'it doesn't need to be protected?
sheet3.unprotect
sheet3.range("A1").currentregion.name = "dbexport"
sheet3.protect
 
'or you could even protect it with userinterfaceonly:=true
 
'another thought, if you leave the workbook protected,
'I think you won't be able to query it

This worked great, thanks. I had never used the currentregion function. I use Ctrl+* to select the current region when I'm in the worksheet, but I never figured VBA would have an equivalent.

Thanks from Cape Town!
 
Upvote 0

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
This worked great, thanks. I had never used the currentregion function. I use Ctrl+* to select the current region when I'm in the worksheet, but I never figured VBA would have an equivalent.
The Macro Recorder can be a great tool for making these discoveries! Just record yourself doing it on the worksheet and see what VBA code results.
 
Upvote 0

Forum statistics

Threads
1,215,471
Messages
6,124,999
Members
449,201
Latest member
Lunzwe73

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