Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-11-2013, 09:11 PM
oalrashdan oalrashdan is offline (Excel 2007) Need help with colour change when condition met in drop down list Windows XP (Excel 2007) Need help with colour change when condition met in drop down list Office 2007
Novice
(Excel 2007) Need help with colour change when condition met in drop down list
 
Join Date: Dec 2013
Posts: 1
oalrashdan is on a distinguished road
Default (Excel 2007) Need help with colour change when condition met in drop down list

Hi all, first post here your help is highly appreciated.



I Have Vba drop down list with 9 words and you can choose multiple choices. What i want to do is for each word chosen to change the colour of the whole row. I have tried many ways but its not working with me.

The code below I use for multiple choices.

PHP Code:
Private Sub Worksheet_Change(ByVal Target As Range)

Dim rngDV As Range
Dim oldVal 
As String
Dim newVal 
As String
If Target.Count 1 Then GoTo exitHandler

On Error Resume Next
Set rngDV 
Cells.SpecialCells(xlCellTypeAllValidation)
On Error GoTo exitHandler

If rngDV Is Nothing Then GoTo exitHandler

If Intersect(TargetrngDVIs Nothing Then
   
'do nothing
Else
  Application.EnableEvents = False
  newVal = Target.Value
  Application.Undo
  oldVal = Target.Value
  Target.Value = newVal
  If Target.Column = 6 Then
    If oldVal = "" Then
      '
do nothing
      
Else
      If 
newVal "" Then
      
'do nothing
      Else
      Target.Value = oldVal _
        & ", " & newVal
'      
NOTEyou can use a line break,
'      instead of a comma
'      
Target.Value oldVal _
'        & Chr(10) & newVal
      End If
    End If
  End If
End If

exitHandler:
  Application.EnableEvents = True
End Sub 
Reply With Quote
  #2  
Old 12-13-2013, 02:21 AM
macropod's Avatar
macropod macropod is offline (Excel 2007) Need help with colour change when condition met in drop down list Windows 7 32bit (Excel 2007) Need help with colour change when condition met in drop down list Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You should be able to do that using conditional formatting alone, without resorting to code.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
(Excel 2007) Need help with colour change when condition met in drop down list How to import list from Excel into drop-down list into word ahw Word VBA 43 02-28-2020 08:11 PM
(Excel 2007) Need help with colour change when condition met in drop down list Drop down menus colour formatting - Newbie question TerryStevenson Word 2 09-17-2013 10:43 AM
(Excel 2007) Need help with colour change when condition met in drop down list Change cell color when selection is made from a drop down list fedcco Excel 12 08-28-2012 10:43 PM
(Excel 2007) Need help with colour change when condition met in drop down list drop down list from external data source Excel 2007? Intruder Excel 1 08-03-2012 05:41 AM
Ecel 2007 Condition Formatting Corca Excel 0 02-01-2012 06:55 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:49 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft