Dynamic Range with VBA

Maslan

New Member
Joined
Mar 6, 2002
Messages
11
Hi,
I used this code to try and define a dynamic range. Got it by recording macro. While it is defined in the Insert->Define->Name menu, references to Range("DATABASE") will cause error "Reference is invalid" -- Help??

xlBook.Names.Add Name:="DATABASE", RefersToR1C1:= _
"=OFFSET(Sheet1!R1C1,0,0,COUNTA(Sheet1!C1),6)"
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
There are different way to define a dynamic ranges in VBA.. Each way has its own limitations and advantage. It is very difficult to make someone understand on Net.

If you want to know how to define dynamic ranges goto my website and download file 16.

Name of the file is "Populating Combobox."

It demonstrates how you can make the range dynamic.

I hope you must have some knowledge in VBA.

I hope you will like to file.

http://www.pexcel.com/download.htm
ni****h desai
 
Upvote 0

Forum statistics

Threads
1,214,875
Messages
6,122,040
Members
449,063
Latest member
ak94

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