Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I have the following code: Dim G as Integer G = Worksheets("Movies").WorksheetFunction.CountIf("AE :AE", "G") I'm assuming I'm simply not using the CountIf function correctly but I keep getting Subscript Out Of Range. What am I doing wrong? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi, Try this but note your criteria of G was invalid and subscriot out of range could mean your sheet name Movies is spelt incorrectly G = WorksheetFunction.CountIf(Sheets("Movies").Range(" AE:AE"), Sheets("Movies").Range("G1")) Mike "Bishop" wrote: I have the following code: Dim G as Integer G = Worksheets("Movies").WorksheetFunction.CountIf("AE :AE", "G") I'm assuming I'm simply not using the CountIf function correctly but I keep getting Subscript Out Of Range. What am I doing wrong? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Still getting the same error. And I verified that the sheet name is spelled correctly. Other ideas? "Mike H" wrote: Hi, Try this but note your criteria of G was invalid and subscriot out of range could mean your sheet name Movies is spelt incorrectly G = WorksheetFunction.CountIf(Sheets("Movies").Range(" AE:AE"), Sheets("Movies").Range("G1")) Mike "Bishop" wrote: I have the following code: Dim G as Integer G = Worksheets("Movies").WorksheetFunction.CountIf("AE :AE", "G") I'm assuming I'm simply not using the CountIf function correctly but I keep getting Subscript Out Of Range. What am I doing wrong? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On 1 Iul, 23:51, Bishop wrote:
*Other ideas? I think it cann't Dim G as Integer , maybe Dim G As Worksheet . |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In the same time , Countif is looking for
criteria ,, G ,, , which have the same name with your G variable , rename variable G with another name . |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Maybe the activeworkbook isn't what you expected. Or your worksheet name isn't spelled correctly (check for leading/trailing spaces, too!) Bishop wrote: Still getting the same error. And I verified that the sheet name is spelled correctly. Other ideas? "Mike H" wrote: Hi, Try this but note your criteria of G was invalid and subscriot out of range could mean your sheet name Movies is spelt incorrectly G = WorksheetFunction.CountIf(Sheets("Movies").Range(" AE:AE"), Sheets("Movies").Range("G1")) Mike "Bishop" wrote: I have the following code: Dim G as Integer G = Worksheets("Movies").WorksheetFunction.CountIf("AE :AE", "G") I'm assuming I'm simply not using the CountIf function correctly but I keep getting Subscript Out Of Range. What am I doing wrong? -- Dave Peterson |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() That was it! When I made the Movies worksheet active (it wasn't before) it worked. But I need this in a With block. I tried this: With Worksheets("Movies") G = .WorksheetFunction.CountIf(Sheets("Movies").Range( "AE:AE"), Sheets("Movies").Range("G1")) But that's not working. Will this work in a With block? "Dave Peterson" wrote: Maybe the activeworkbook isn't what you expected. Or your worksheet name isn't spelled correctly (check for leading/trailing spaces, too!) Bishop wrote: Still getting the same error. And I verified that the sheet name is spelled correctly. Other ideas? "Mike H" wrote: Hi, Try this but note your criteria of G was invalid and subscriot out of range could mean your sheet name Movies is spelt incorrectly G = WorksheetFunction.CountIf(Sheets("Movies").Range(" AE:AE"), Sheets("Movies").Range("G1")) Mike "Bishop" wrote: I have the following code: Dim G as Integer G = Worksheets("Movies").WorksheetFunction.CountIf("AE :AE", "G") I'm assuming I'm simply not using the CountIf function correctly but I keep getting Subscript Out Of Range. What am I doing wrong? -- Dave Peterson |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() No more ideas, it works perfectly for me and subscript out of range is Excels way of telling you it can't find something your telling it to look for Mike "Bishop" wrote: Still getting the same error. And I verified that the sheet name is spelled correctly. Other ideas? "Mike H" wrote: Hi, Try this but note your criteria of G was invalid and subscriot out of range could mean your sheet name Movies is spelt incorrectly G = WorksheetFunction.CountIf(Sheets("Movies").Range(" AE:AE"), Sheets("Movies").Range("G1")) Mike "Bishop" wrote: I have the following code: Dim G as Integer G = Worksheets("Movies").WorksheetFunction.CountIf("AE :AE", "G") I'm assuming I'm simply not using the CountIf function correctly but I keep getting Subscript Out Of Range. What am I doing wrong? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
runtime error '1004' application or object defined error | Excel Programming | |||
runtime error 13 - type mismatch error in Excel 97 on Citrix | Excel Programming | |||
runtime error '1004' application or object defined error. Please help | Excel Programming | |||
Excel 2003 Macro Error - Runtime error 1004 | Excel Discussion (Misc queries) | |||
Syntax Error Runtime Error '424' Object Required | Excel Programming |