Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Custom functions
Custom functions
Resolved · High Priority · Version 2007
Custom functions
HiI've created a quick custom function where I want the background colour of a cell to change if another cell has the word 'yes' entered.
Is there anything obviously wrong with the below?
Function ThreeD(B As String)
If B = "Yes" Then
ThreeD.Interior.Color = RGB(127, 127, 127)
Else
ThreeD = 0
End If
End Function
Thanks! Diane
For upcoming training course dates see: Pricing & availability
RE: custom functions
Hi DianeThanks for the question
It is not possible to use a function to achieve what you are attempting
I have created the following sub procedurenwhich you can adapt to solve your problem
Sub ThreeD()
Dim B As String
B = Cells(1, 1).Value
If B = "Yes" Then
Cells(1, 1).Interior.Color = RGB(127, 127, 127)
Else
Cells(1, 1).Interior.Color = RGB(0, 0, 0)
End If
End SubHope this helps
Regards
Stephen
Tue 23 Feb 2010: Automatically marked as resolved.
|
|
» Forum post: If statements |



Course updates

