Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

inserting a symbol using a excel formula

Status
Not open for further replies.

nfontijn

Technical User
Aug 31, 2003
1
IL
I have a excell sheet that looks like:
A B C
1 108 Arial =mySymbol(A1,B1)
2 95 myTTF =mySymbol(A2,B2)

the truble is that I can't get the vba function to change the font (name) for the formula cell. Is there a way around this to be able too make changes to the worksheet form a vba function that is called as a formula

TIA
Naftaly
 
If you want to change the font, you have to use the Wrokbook_Change Event or use a button connected to a procedure.

If you want to return a symbol, then you can use the CHAR() function. =CHAR(108) will return a "|".

Good Luck!



Peace! [peace]

Mike

Never say Never!!!
Nothing is impossible!!!
 
Hi Naftaly,
I was just crusing the posts and your reminded me of the same problem I was have with a function I created awhile back, I need it to change the font on the cell depending on what the result was, I tried for ages to get the function to do it, and eventually gave up. But looking at your post got me thinking of it again and while I still couldn't get the function to change the font I just called a sub from the function, easy, "why didn't I think of that before"? I don't know if you have solved your problem, but here is how I solved mine.

Function ohmslaw(Optional Resistance, Optional Voltage, Optional Current)
Dim result As Variant

On Error Resume Next

If result = Not Voltage Then
ohmslaw = Format(Resistance * Current, "#,##0.00 V")
Exit Function
End If

If result = Not Current Then
ohmslaw = Format(Voltage / Resistance, "#,##0.00 A")
Exit Function
End If

If result = Not Resistance Then
ohmslaw = Format(Voltage / Current, "#,##0.00 W")
Call changefont ' [/red]call the change font subroutine if the result is resistance [/red]
Exit Function
End If

ohmslaw = Format(Voltage / Resistance, "#,##0.00 A")

Exit Function

errorhandler3:
MsgBox "An Error Has Occurred in Your Function", vbCritical, "Oh No Not Again"

End Function

Sub changefont()
With ActiveCell
.Font.Name = "Symbol"
End With
End Sub

Hope this helps [pipe]

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top