ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Please Correct the mistake (https://www.excelbanter.com/excel-programming/281214-please-correct-mistake.html)

Michael168[_45_]

Please Correct the mistake
 
I have this formula in a macro.

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

It gives me error. Please Help

Thanks & Regards.



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/


Hank Scorpio

Please Correct the mistake
 
On Sat, 1 Nov 2003 02:56:39 -0500, Michael168
wrote:

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.

I have this formula in a macro.

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

It gives me error. Please Help



---------------------------------------------------------
Hank Scorpio
scorpionet who hates spam is at iprimus.com.au (You know what to do.)
* Please keep all replies in this Newsgroup. Thanks! *

RADO[_3_]

Please Correct the mistake
 
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


"Michael168" wrote in message
...
I have this formula in a macro.

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

It gives me error. Please Help

Thanks & Regards.



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/





All times are GMT +1. The time now is 12:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com