Thread: Runtime Error 9
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Runtime Error 9


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