Thread: Excel 2000
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gary L Brown Gary L Brown is offline
external usenet poster
 
Posts: 219
Default Excel 2000

The only way that I can think of to address your first issue is with a
specialized SUM UDF such as....
'/===========================================/
Public Function SumNotStrikeThru(Select_Cells As Range) As Double
Dim rngCell As Range
Application.Volatile
On Error Resume Next
SumNotStrikeThru = 0
For Each rngCell In Select_Cells
If WorksheetFunction.IsNumber(rngCell) Then
If rngCell.Font.Strikethrough = False Then
SumNotStrikeThru = SumNotStrikeThru + rngCell
End If
End If
Next rngCell
End Function
'/===========================================/

Your second issue is one of 'when does the worksheet calculate'. I'm not
going to get complicated with Class Modules and such so I'd say your best bet
is to either hit the F9 key every so often or put some code in the specific
worksheet that you are having this issue with so that when you move your
cursor the whole worksheet calculates....
'/===========================================/
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.Calculate
End Sub
'/===========================================/
HTH,
--
Gary Brown

If this post was helpful, please click the ''Yes'' button next to ''Was this
Post Helpfull to you?''.


"Ken" wrote:

Thanks Gary,

Parts of the script accomplished what I was looking for.
IsStrikethrough varies from TRUE to FALSE but does not affect the results.

I am trying to:
When I strike through a number in a cell, I do not want the number to sum in
A5.
A1 = 1
A2 =2
A3=SUM(A1..A2) results 3 A3 is not affected by strikethrough

I want:
A5 = 3 when the numbers are not strikethrough
A5 = 1 when A2 is strikethrough
A5 = 2 when A1 is strikethrough

The other problem is the function does not run when the strikethrough is
added to the cell, it only runs when the number is changed.

Your thoughts!

Thanks

Ken

"Gary L Brown" wrote in message
...
You need a User-Defined-Function like 'IsStrikeThru' below.
Then you can use an if statement.
Ex. If(IsStrikeThru(A5)=True,"It's a Strike!","No Strike.")

'/========================================/
Public Function IsStrikeThru(Select_Cell As Range) As Boolean
On Error Resume Next
Application.Volatile
IsStrikethrough = Select_Cell.Font.Strikethrough
End Function
'/========================================/

If you want to make the UDF available to all YOUR workbooks, put it in

your
Personal.xls.

HTH,
--
Gary Brown

If this post was helpful, please click the ''Yes'' button next to ''Was

this
Post Helpfull to you?''.


"Ken" wrote:

How do I use a if statement to determine if a number has been formatted

with
a strikethrough?

I could not locate a function that determines the formatting of a

number.