![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Mar 2002
Posts: 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)" |
|
|
|
|
|
#2 |
|
Banned
Join Date: Feb 2002
Posts: 1,582
|
Hi
2 Things 1. You dynamic range will NOT be dynamic if you just use: "COUNTA(Sheet1!C1)" This will return either 1 or 0 2. You have "xlBook" I assume this is a Workbook Object variable?? Try using "ActiveWorkbook" I have many eaxmples of Dynamic ranges here: http://www.ozgrid.com/Excel/DynamicRanges.htm |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Location: Ahmedabad Gujarat
Posts: 303
|
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 nishith desai |
|
|
|
|
|
#4 |
|
New Member
Join Date: Mar 2002
Posts: 11
|
Cheers guys.. Got it at last... Me = silly
Thanks for the files.. |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|