G
Guest
I find this intriguing...but I couldn't get it to work.
I pasted it into the window as instructed but nothing happened...
Is there something that activates it? a doubleclick, or someting else?
My VBA is rudimentary and I find experimenting with things like this useful
in brnging me up the curve...
thanks,
Why should I rate a post?
I pasted it into the window as instructed but nothing happened...
Is there something that activates it? a doubleclick, or someting else?
My VBA is rudimentary and I find experimenting with things like this useful
in brnging me up the curve...
thanks,
Was this post helpful to you?Ron Rosenfeld said:You would need to use a VBA routine, as what you want to do requires a text
string be in the cell.
You could make it a standalone "Sub", attach it to a button, or use it as an
event-triggered routine which would kind of make it automatic.
For the latter, right click on the sheet tab, and paste the following code into
the window that opens. I've made a few additions to your specifications that
you might find interesting (or not). You might want to change some of the
parameters.
================================================
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim dSum As Double
Dim rSrc As Range
Dim rDest As Range
Dim sStr As String
Dim i As Long
Set rSrc = Range("a1:a4")
Set rDest = Range("b1")
dSum = Application.WorksheetFunction.Sum(rSrc)
Application.ScreenUpdating = False
Application.EnableEvents = False
Select Case dSum
Case 1 To 10
sStr = "Not Bad Team"
Case 11 To 20
sStr = "Good Work Team"
Case Is > 20
sStr = "Great Work Team!!"
End Select
rDest.Value = "The yearly gross is " & dSum & ". " & sStr
i = InStr(1, rDest.Text, "Great")
If i > 0 Then
With rDest
.Characters(i, 5).Font.Bold = True
.Characters(i, 5).Font.Color = vbRed
End With
End If
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub
================================================
--ron
Why should I rate a post?