LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Problems evaluating defined names in VBA

I have a project where I work a lot with dynamic names and ranges. I
have defined names such as the one below

TotalNumberOfRowsData=COUNTA(Rawdata!$B:$B)

I am referring to these ranges from the worksheet as well as from VBA.
Everything has worked like a charm, but now I want to make it more
generic. I have defined some names that are initiated at startup from
constants, which makes them easy to change. The constants refer to
which columns certain data can be found etc. I then use these
initiated names in the other defined names, by using the indirect
function in different ways (not very pretty if I may say so myself,
but the only way that I found to be working). By doing like this, I
get the option to get functions similar to the one below by just
changing two constants (the contstants for the sheetname and for the
column).

TotalNumberOfRowsData=COUNTA(OtherData!$C:$C)

This also works as long as I stay in the worksheet, but when I try to
access these names in VBA with the evaluate function, I get error 2023
(or totally incorrect answers).

The only explanation I can find is that the indirect function does not
work really well with evaluate, but I haven't found out how to change
it. Does anyone know of any way to come around this problem (it does
not need to be with the indirect function, it can be any other way) I
would be very grateful.

I have found a way by inserting an equal sign in front of the name,
but this only works when indirect is in the first position of the
name.

//Anders

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
defined names xcel user[_2_] Excel Worksheet Functions 1 December 14th 07 05:43 PM
Defined names lesley1000 via OfficeKB.com Excel Worksheet Functions 3 December 10th 07 02:50 PM
Evaluating names range from two different workbooks. Barb Reinhardt Excel Programming 0 February 27th 07 04:36 PM
NAMES DEFINED F. Lawrence Kulchar Excel Discussion (Misc queries) 5 November 14th 06 07:54 AM
Defined Names rickv Excel Programming 4 August 6th 05 01:39 PM


All times are GMT +1. The time now is 01:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"