Runtime Error 9

B

Bishop

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?
 
M

Mike H

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
 
B

Bishop

Still getting the same error. And I verified that the sheet name is spelled
correctly. Other ideas?
 
Top