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 » Icolor, target,range
Icolor, target,range
Resolved · Medium Priority · Version 2003
Scott has attended:
Access Introduction course
Access Intermediate course
Access Advanced course
Access VBA course
Icolor, target,range
How do I get vba to shade a cell using VBA dependant on the text in another column (typically the column immediately to the right?
RE: icolor, target,range
Hi Scott
The code below looks at text in column B of a workbook and whatever text it finds it colours the adjacent cell in column A either Green, Red or leaves the cell Uncoloured if the words don't match.
Sub ColourFormatByText()
Dim intCounter As Integer
For intCounter = 2 To 20
Select Case Cells(intCounter, 2).Value
Case "Hello"
Cells(intCounter, 1).Interior.ColorIndex = 3
Case "Goodbye"
Cells(intCounter, 1).Interior.ColorIndex = 4
Case Else
Cells(intCounter, 1).Interior.ColorIndex = xlNone
End Select
Next intCounter
End Sub
I have attached a Workbook so you can see the code at work
Hope this helps
Carlos
Attached files...
RE: icolor, target,range
Hi Carlos,
I can see what it should do, but no joy on my pc! I have the VBA add-ins selected, could I be missing something?
Rgds
Scott
RE: icolor, target,range
Hi Scott
Are you saying the workbook I sent you is not working on your PC?
Regards
Carlos
RE: icolor, target,range
Hi Carlos,
Yes, coming down to Southwark Tuesday/Wednesday for Access courses if you are about?
Regards
Scott
RE: icolor, target,range
Hi Scott
No I'm not in Southwark next week. I am training at other sites.
Since the workbook I sent you does not work on your PC, there seems to be a software problem with Excel on your PC and you may need to contact your IT department to fix it.
Regards
Carlos
Thu 4 Jun 2009: 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:Apply currency format quickly in ExcelTo quickly apply the currency format to cell in your spreadsheet, select (highlight) the cells you wish to apply currency format to, then use Ctrl + Shift + $ |