define names using COUNTA

hulei

New Member
Joined
Jun 23, 2010
Messages
11
Hey guys, first of all thanks for the support during the whole time, i used this forum quite regularly

I finally signed up because I cannot figure out how to solve a (hopefully) minor problem.

I am using VBA to automatically create a bunch of defined names on a help! sheet in order to create three dependant DropDowns on my presentation! sheet.

My Macro is using this code to create the names as soon as it finds a title in the worksheet

ActiveWorkbook.Names.Add Name:=Sheets("help").Cells(a, c).Value, RefersTo:="=OFFSET(help!$B$50,0,0,COUNTA(help!$B$50:$B$150),)"

[ the ranges are actually variables in my sheet, but its easier that way I guess ]

this all works fine, I get the names and they perfectly do what I want. Whenever I click on define > name > range, only the cells containing values will be counted by the COUNTA function.

I checked the names, everything should be fine, and everything worked before I used the COUNTA function.
Now, not anymore. When I want to use the =INDIRECT() Function to create a dependant DropDown, the usual "Source creates an error" message shows up, but then iut just wont work anymore.

Is it possible that I have to exclude the COUNTA part? Did anybody had this kind of problems?
I dont see the problem. The Names only include letters and "_', as soon as there is a " " a macro will substitute this into "_"

I read somewhere that conditional formatting might be the problem. Im am using vba to color the "_" in the defined names white. But this only gets triggered once the cells have been changed, it should therefore not have any influence on the appearance of the DropDown itself

I am using Win XP & Excel 2003

Hope somebody has an idea what I could do, thanks in advance :-)
HuLei
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
thanks for the hint

I solved the problem by putting absolute references in the names. I have VBA calculting Startpoint and endpoint of the range ( finding out the last row in a column ) and simply substituted the OFFSET function with this.
 
Upvote 0

Forum statistics

Threads
1,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

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