Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi All,
I have the following formula in vba: ..Formula = "=COUNTIFS('[" & strName & "]Sheet1'!$E:$E,A2,'[" & strName & "]Sheet1'!$H:$H,""0"")" The file I am referencing via the variable strName only has one sheet...but what I am finding is that the sheet name is not always Sheet1. How can I modify the formula to select the only sheet in the workbook? Thanks! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
Try replacing Sheet1 with " & Workbooks(strName).Sheets(1).Name & " HTH. Best wishes Harald "Steve" wrote in message news:3109790.209.1332264505214.JavaMail.geo-discussion-forums@ynbu11... Hi All, I have the following formula in vba: .Formula = "=COUNTIFS('[" & strName & "]Sheet1'!$E:$E,A2,'[" & strName & "]Sheet1'!$H:$H,""0"")" The file I am referencing via the variable strName only has one sheet...but what I am finding is that the sheet name is not always Sheet1. How can I modify the formula to select the only sheet in the workbook? Thanks! |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Harald Staff wrote:
"Steve" wrote in message news:3109790.209.1332264505214.JavaMail.geo-discussion-forums@ynbu11... I have the following formula in vba: .Formula = "=COUNTIFS('[" & strName & "]Sheet1'!$E:$E,A2,'[" & strName & "]Sheet1'!$H:$H,""0"")" The file I am referencing via the variable strName only has one sheet...but what I am finding is that the sheet name is not always Sheet1. How can I modify the formula to select the only sheet in the workbook? Try replacing Sheet1 with " & Workbooks(strName).Sheets(1).Name & " Alternately, ActiveCell.Parent.Name would also work (or in the specific code Steve posted, just .Parent.Name). As the Perl slogan says, there's more than one way to do it. -- I'll be honest. I have no freakin' clue what these people are trying to accomplish. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Awesome. Thanks guys!
On Tuesday, March 20, 2012 11:28:25 AM UTC-6, Steve wrote: Hi All, I have the following formula in vba: .Formula = "=COUNTIFS('[" & strName & "]Sheet1'!$E:$E,A2,'[" & strName & "]Sheet1'!$H:$H,""0"")" The file I am referencing via the variable strName only has one sheet...but what I am finding is that the sheet name is not always Sheet1. How can I modify the formula to select the only sheet in the workbook? Thanks! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Vba Formula To Include Activesheet Name | Excel Programming | |||
Use a password in VBA ActiveSheet.protect & ActiveSheet.unprotect? | Excel Programming | |||
Copying new activesheet after other activesheet is hidden? | Excel Programming | |||
activesheet | Excel Programming | |||
ActiveSheet | Excel Programming |