Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am relatively new to programming. Can anyone suggest the code for the
following: I want to highlight each row that contains a certain value in a particular column. For Each Row that contains X in Cell F then highlight row. Can anyone get me started? Thanks Michael |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This should get you started.
For Each cell In Range("F1:F65536") If cell.Value = "X" _ Then cell.EntireRow.Select With Selection.Interior .ColorIndex = 6 .Pattern = xlSolid End With Else: End If Next cell This changes the background color of the entire row to yellow if the value of the cell in column F is "X". Modify as necessary. HTH, Paul "MGSurberDallas" wrote in message ... I am relatively new to programming. Can anyone suggest the code for the following: I want to highlight each row that contains a certain value in a particular column. For Each Row that contains X in Cell F then highlight row. Can anyone get me started? Thanks Michael |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dim I as Long, lngFRow as Long, lngLRow as Long, wshList as Worksheet
Set wshList = Workbooks("Book1.xls").Worksheets("Sheet1") 'Sets the variable to a reference of the worksheet you want to manipulate lngFRow = 5 'The first row number you want to check for highlighting lngLRow = 2000 'The last row number you want to check for highlighting For I = lngFRow to lngLRow Step 1 If wshList.Range("F" & CStr(I)).Value = 50 Then 'Checks to see if the F column contains a numeric value of 50 wshList.Range(CStr(I) & ":" & CStr(I)).Interior.ColorIndex = 8 'Cyan background color if the value of that row in the F column is 50 Else wshList.Range(CStr(I) & ":" & CStr(I)).Interior.ColorIndex = xlColorIndexNone 'No background color otherwise EndIf Next I -- Ronald R. Dodge, Jr. Production Statistician/Programmer Master MOUS 2000 "MGSurberDallas" wrote in message ... I am relatively new to programming. Can anyone suggest the code for the following: I want to highlight each row that contains a certain value in a particular column. For Each Row that contains X in Cell F then highlight row. Can anyone get me started? Thanks Michael |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Use conditional formatting.
See http://www.contextures.com/xlCondFormat01.html -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "MGSurberDallas" wrote in message ... I am relatively new to programming. Can anyone suggest the code for the following: I want to highlight each row that contains a certain value in a particular column. For Each Row that contains X in Cell F then highlight row. Can anyone get me started? Thanks Michael |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Ron. I'll give it a shot!
Michael "Ronald Dodge" wrote: Dim I as Long, lngFRow as Long, lngLRow as Long, wshList as Worksheet Set wshList = Workbooks("Book1.xls").Worksheets("Sheet1") 'Sets the variable to a reference of the worksheet you want to manipulate lngFRow = 5 'The first row number you want to check for highlighting lngLRow = 2000 'The last row number you want to check for highlighting For I = lngFRow to lngLRow Step 1 If wshList.Range("F" & CStr(I)).Value = 50 Then 'Checks to see if the F column contains a numeric value of 50 wshList.Range(CStr(I) & ":" & CStr(I)).Interior.ColorIndex = 8 'Cyan background color if the value of that row in the F column is 50 Else wshList.Range(CStr(I) & ":" & CStr(I)).Interior.ColorIndex = xlColorIndexNone 'No background color otherwise EndIf Next I -- Ronald R. Dodge, Jr. Production Statistician/Programmer Master MOUS 2000 "MGSurberDallas" wrote in message ... I am relatively new to programming. Can anyone suggest the code for the following: I want to highlight each row that contains a certain value in a particular column. For Each Row that contains X in Cell F then highlight row. Can anyone get me started? Thanks Michael |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you SO much Paul. It worked like a charm.
Best Regards, Michael "PCLIVE" wrote: This should get you started. For Each cell In Range("F1:F65536") If cell.Value = "X" _ Then cell.EntireRow.Select With Selection.Interior .ColorIndex = 6 .Pattern = xlSolid End With Else: End If Next cell This changes the background color of the entire row to yellow if the value of the cell in column F is "X". Modify as necessary. HTH, Paul "MGSurberDallas" wrote in message ... I am relatively new to programming. Can anyone suggest the code for the following: I want to highlight each row that contains a certain value in a particular column. For Each Row that contains X in Cell F then highlight row. Can anyone get me started? Thanks Michael |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
change "true" and "false" to "availble" and "out of stock" | Excel Worksheet Functions | |||
Need more than 7 nested "IF" statements in Excel" | Excel Discussion (Misc queries) | |||
HELP on "left","right","find","len","substitute" functions | Excel Discussion (Misc queries) | |||
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next | New Users to Excel |