Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 175
Default Still having problem with IF-Then statement

I hate to keep taking up space for this, but it just won't work for me.
I've tried to work around it from a differnt angle, but damn, this
should work! And, it seems it should be so simple. I really appreciate
the reponses I've gotten on this problem. It's very frustrating. Here's
the solution given to me before.... and I'm sure it's a good one. But,
why doesn't it work for me?

'If Range("Deleted_Today") = 0 Then
' FormatCells
' Else
' Move_Deleted_Records
' End If

I want it to look at the range name "Deleted_Today". This is in a
worksheet named Touches. It contains a formula that counts any entries
in a column in a different worksheet, named Official List. Here's that
formula:
=COUNTA('Official List'!P6:P4366)

If there are any entries in that column, the number will be more than 0
in "Deleted_Today". If that is the case, I want the macro to go to the
sub named FormatCells. If there is anything greater than 0 in
"Deleted_Today", then it want it to go the sub named
Move_Deleted_Records.

However there is an error when I run it, and the 1st line of the
statement is hightlighted. I've checked all the spellings. Should I
specify the worksheets?

I was given this statement as an alternative, but I get the same
results.

If Application.CountA(Range("Deleted_Today")) = 0 Then
' FormatCells
' Else
' Move_Deleted_Records
' End If

Does it matter if there is a formula in that cell, or if it just a
value? I even tried to replace the formula in "Deleted_Today" with a
0. Same error.

No sense in programming if you can't do a simple If-then. My
spreadsheet designs are full of If-then formulas. It's the basic tool
of spreadsheets design for me.
Bob Phillips, you have given me alot of time, and have been very
patient. If you, or anyone else can figure out what stupid mistake I'm
making, I would greatly appreciate it.

Thanks
HELP!!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 126
Default Still having problem with IF-Then statement

Try one of the following:

If Sheeets("Touches").Range("Deleted_Today").Value = 0 Then
FormatCells
Else
Move_Deleted_Records
End If

OR


If Application.WorksheetFunction.CountA(Range("Delete d_Today")) = 0 Then
FormatCells
Else
Move_Deleted_Records
End If


"excelnut1954" wrote:

I hate to keep taking up space for this, but it just won't work for me.
I've tried to work around it from a differnt angle, but damn, this
should work! And, it seems it should be so simple. I really appreciate
the reponses I've gotten on this problem. It's very frustrating. Here's
the solution given to me before.... and I'm sure it's a good one. But,
why doesn't it work for me?

'If Range("Deleted_Today") = 0 Then
' FormatCells
' Else
' Move_Deleted_Records
' End If

I want it to look at the range name "Deleted_Today". This is in a
worksheet named Touches. It contains a formula that counts any entries
in a column in a different worksheet, named Official List. Here's that
formula:
=COUNTA('Official List'!P6:P4366)

If there are any entries in that column, the number will be more than 0
in "Deleted_Today". If that is the case, I want the macro to go to the
sub named FormatCells. If there is anything greater than 0 in
"Deleted_Today", then it want it to go the sub named
Move_Deleted_Records.

However there is an error when I run it, and the 1st line of the
statement is hightlighted. I've checked all the spellings. Should I
specify the worksheets?

I was given this statement as an alternative, but I get the same
results.

If Application.CountA(Range("Deleted_Today")) = 0 Then
' FormatCells
' Else
' Move_Deleted_Records
' End If

Does it matter if there is a formula in that cell, or if it just a
value? I even tried to replace the formula in "Deleted_Today" with a
0. Same error.

No sense in programming if you can't do a simple If-then. My
spreadsheet designs are full of If-then formulas. It's the basic tool
of spreadsheets design for me.
Bob Phillips, you have given me alot of time, and have been very
patient. If you, or anyone else can figure out what stupid mistake I'm
making, I would greatly appreciate it.

Thanks
HELP!!


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 175
Default Still having problem with IF-Then statement

Looks like the 1st option was successful. I was thinking of adding the
sheet name, but I didn't know the proper syntax.
I just don't know enought yet to explain why the other options given to
me didn't work. I probably just didn't explain the layout well enough.
If that's the case, then thanks for reading my mind to find out what I
was after. Thanks Cush.

Thankyou Bob Phillips & Leith Ross for your contributions. I save them
all for future reference. I hope to learn this well enough to be able
to contribute, and help someone like you guys do.

Thanks again.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Still having problem with IF-Then statement


Hello Excelnut1954,

Change this line: If Application.CountA(Range("Deleted_Today")) = 0
Then

To: If WorksheetFunction.CountA(Range("Deleted_Today")) = 0 Then

This should fix the problem provided Deleted_Today is a named Range. If
not you will have to add the worksheet also. Just change Sheet1 to the
name of the sheet the range is on.

Alternate: If
WorksheetFunction.CountA(Worksheets("Sheet1").Rang e(("Deleted_Today"))
= 0 Then

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=494374

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
IF Statement problem MarkFrost39 Excel Worksheet Functions 0 September 6th 07 02:50 PM
IF statement problem webstju Excel Worksheet Functions 3 April 21st 06 12:58 PM
Re - If Statement Problem Robert Hargreaves Excel Programming 0 May 28th 05 01:30 PM
If Statement problem Robert Hargreaves Excel Programming 1 May 28th 05 01:12 PM
Problem with if statement Marie Excel Programming 13 February 7th 05 01:25 AM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"