custom functions
Microsoft Office TrainingThe UK's Number 1 for Microsoft Office Training Sitemap add this page to your favourites/bookmarksBookmark page
 
view a printable version of this pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Custom functions

Custom functions

resolvedResolved · High Priority · Version 2007

replyReplyTue 16 Feb 2010, 15:30Delegate Diane said...

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

For upcoming training course dates see: Pricing & availability

replyReplyWed 17 Feb 2010, 10:32Trainer Stephen said...

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.

 

 

Please browse our web site to find out more about
exce+training and other Microsoft training courses.

Excel tip:

Formula for last day of month

In some cases it is necessary to find the last day of a month for a given date. If you use the following formula, you can achieve this, ie; if you have a column of dates, use this formula to find the end of month for each day by using the fill handle. The formula is as follows, and assumes in this example that the first date in question is in cell C5, in any other cell type; =DATE(YEAR(C5),MONTH(C5)+1,1)-1

View all Excel hints and tips

forum postI would like to create a form in which special characters such as % and £ can be detected and replaced with 'percent' and 'pound', how is this possible?

» Forum post: If statements


Rate this page:
2.2/5 (213 votes cast)
Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses
Microsoft Certified Partner
Security Seal verified by visa, mastercard securecard

Mini sitemap. These are the main areas of our web site. Full sitemap.

Management training

Professional Skills courses
Project Management Course London
Project Management Courses London
Project Management Training London
Project Management Training
Project Seminar
Project Seminars
Time Management Course London
Time Management London
Time Management Courses London
Time Management Training London
Introduction to Finance course
Assertiveness Skills course
Effective Communications Skills training
Presentation Skills London

Training Formats

Public scheduled courses
On-site training
Closed company courses

Consultancy
Application Development

Blogs

Excel Training
MS Project Training
Microsoft Training Blog

Version differences

Office 2010 vs 2007
MS Project version differences

Training Information

London Computer Training
Computer Training London
Docklands Training Courses
Docklands Training London

Training venues London
Client list
FAQ
Pricing and availability
Course details / Syllabus

Training Articles
Training Information

Microsoft training

Microsoft Office training
& IT Applications

Microsoft Project training
Microsoft Outlook training
Microsoft Powerpoint training
Microsoft Word training
MS Project courses
MS Project training
Outlook courses
PowerPoint courses
PowerPoint training
VBA courses
Word courses
Microsoft.training
(more...)

Excel Training

Excel courses
Excel Training Courses Medway
Autonumber in Excel
Microsoft Excel training
Basic Excel Courses
Basic Excel Course
Basic Excel Training

Interested in MS Access training?

Access courses
Microsoft Access training
Microsoft access courses
Microsoft training access course
Microsoft+access+training
Access courses in london

Training provider

Training providers
IT training companies
IT training providers
Management Training providers
Management Training provider

Event history, feedback results
Events in 2012 · 2011 · 2010 · More

See also

Crystal Reports training