98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Custom functions
Custom functions
Resolved · High Priority · Version 2007
Diane has attended:
Excel VBA Advanced course
Custom functions
Hi
I'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
RE: custom functions
Hi Diane
Thanks 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 Sub
Hope this helps
Regards
Stephen
Tue 23 Feb 2010: Automatically marked as resolved.
Training information:
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Excel tip:Change the Default Width of All Columns in Excel 2010If you want to change the width of the columns in your Excel 2010 spreadsheet, making them either larger or smaller, here's how: |