R
Richhall
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
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