Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Hi
I am wanting to amend a range defined in my db to a named range. I have a named range on different worksheets such as: Sheet1Week1 Sheet2Week2 My formula is: Application.WorksheetFunction. _CountIf(ws.Range("$G$4:$H$44"), "Banana") I want to change $G$4:$H:44 as a named range Sheet1Week1 or whatever the worksheet is so "wsWeek1". (taking I have defined ws as the ActiveSheet) 1. How do get the range defined, im not sure how to make a variable take text as a value? Dim Week1Range, Week2Range Dim ws ws = ActiveSheet Week1range= ws & "Week1" Week2range= ws & "Week2" 2. Once I have defined Week1range as Sheet1Week1 how do I put this into my formula? So replace: Application.WorksheetFunction. _CountIf(ws.Range("$G$4:$H$44"), "Banana") with Application.WorksheetFunction. _CountIf(ws.Range(Week1range), "Banana") Cheers Rich |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
variable sheet name | Excel Discussion (Misc queries) | |||
Hide a sheet with a variable name | Excel Worksheet Functions | |||
How To make a sheet reference Variable (eq: sum(sheet!D2:H2)) | Excel Discussion (Misc queries) | |||
Variable sheet and Formula Sheet | Excel Discussion (Misc queries) | |||
variable in a link where the variable is the name of the sheet | Excel Worksheet Functions |