Please Correct the mistake

  • Thread starter Thread starter Michael168
  • Start date Start date
M

Michael168

I have this formula in a macro.

If sh2Row = 30 Then
sh2.Cells(32, 3).Value = _
Application.WorksheetFunction.CountIf(Range("C1:C30"), 0)
End If

It gives me error. Please Help

Thanks & Regards.
 
On Sat, 1 Nov 2003 02:56:39 -0500, Michael168

It usually helps when you state what the error IS.

The code works fine for me. Things to check:
- How is the variable sh2Row being populated? Are you sure that it
contains a valid value?
- Are you sure that you have a sheet's CODE NAME, not its NAME, set as
sh2? (As in the line "sh2.Cells(32, 3).Value"). Look in the Project
Explorer of the Visual Basic Editor. (You can turn it on through the
View menu if you can't see it.) Turn on the Properties window. Select
the relevant worksheet in the Project Explorer, and make sure that the
Property shown as (Name) (that is, the one with the brackets around
it) is sh2. If it's not, that's your problem.
 
it appears that you are missing a dot between sh2 and row
should be sh2.Row, otherwise it's interpreted as a variable "sh2row" which
you don't have

RADO
 
Back
Top