Please Correct the mistake

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.
 
H

Hank Scorpio

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.
 
R

RADO

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top