View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mark Kubicki Mark Kubicki is offline
external usenet poster
 
Posts: 89
Default referencing a named range using a variable

referencing a workbook which is open, but not active, i'm trying to get the
value contained in a named range by referencing the name using a variable
defined by the sub

workbook name (inactive): Job Nos for Timesheets.xls
worksheet name: Billing Rates
named range that i'm trying (in this example) to access: rate_Staff
definition of rate_Staff (in the workbook) ='Billing Rates'!$B$7

variable name (that i'm using to reference the name i'm trying to get
the value of): strFeeRateDefaultRange

named range in the active sheet: [EmployeePosition]
value of [EmployeePosition] = "Staff"
strFeeRateDefaultRange = "Rate" & [EmployeePosition]

Set feerate = Workbooks("Job Nos for
Timesheets.xls").Names([strFeeRateDefaultRange]).RefersToRange
rate = feerate.Value
MsgBox ("using default fee rate: " & feerate.Value)

however, the result is not the value of the rate_Staff, but "='Billing
Rates'!$B$7"



me + named ranges = bad combination (don't know why, just have never gotten
the logic...)
thanks in advance
mark