I need a macro/code to highlight a select set of cell/rows with the color blue.
The rows with have a 1 in column A.. All row with 1 need to be highlighted blue.
Thank you in advance for your help..
I need a macro/code to highlight a select set of cell/rows with the color blue.
The rows with have a 1 in column A.. All row with 1 need to be highlighted blue.
Thank you in advance for your help..
not sure if this is the same/close to the other post....but here goes...this does a little more than this thread asks for....
![]()
Sub testing() Dim LastRow As Single, LastRowOnes As Single, x As Single LastRow = Cells(65000, 1).End(xlUp).Row For x = 1 To LastRow If Cells(x, 1).Value = 0 Then LastRowOnes = x - 1 Exit For End If Next x Rows("1:" & LastRowOnes).Select With Selection.Interior .Pattern = xlSolid .PatternColorIndex = xlAutomatic .Color = 15773696 .TintAndShade = 0 .PatternTintAndShade = 0 End With Rows(LastRowOnes + 1 & ":" & LastRowOnes + 1).Select Selection.Insert Shift:=xlDown Selection.Insert Shift:=xlDown Selection.Insert Shift:=xlDown Selection.Insert Shift:=xlDown Selection.Insert Shift:=xlDown Rows(LastRowOnes + 1 & ":" & LastRowOnes + 5).Select With Selection.Interior .Pattern = xlSolid .PatternColorIndex = xlAutomatic .ThemeColor = xlThemeColorDark1 .TintAndShade = 0 .PatternTintAndShade = 0 End With Cells(1, 1).Select End Sub
Ernest
Please consider adding a * if I helped
Nothing drives me crazy - I'm always close enough to walk....
You could use a conditional format
Select B2
Select --> Home > Conditional Formating > Manage Rules >New Rule >Use a formula to determine which cells to format
Format values where this formula is true --> =$A2 = 1
Format --> Select fill = blue
Copy B2 and do a "Paste Special"> Formats" in all cells in all rows and coluns
Last edited by PCI; 11-13-2013 at 05:26 PM.
I am getting a run time error 13 ?type Mismatch... when i run debug the following is highlighted in yellow
Rows("1:" & LastRowOnes).Select
If you really need a macro perhaps try
![]()
Option Explicit Sub ColorRow() Dim F As Range For Each F In Range([A1], Range("A" & Rows.Count).End(xlUp)) If (F.Value = 1) Then F.EntireRow.Interior.Color = 15773696 Next End Sub
PCI.. im not sure how to apply the macro you just wrote above. i copy pasted it into a module in VBAProject(personal.xls8) and then click run to run it..but nothing happened... ..
The macro is working in the active sheet
Ok it worked on the active sheet. but that wud mean that no one else could use it..correct.... how do i share it and use it on other worksheets..with out having to copy and paste it into vba of each worksheet...
You just need to select a sheet to treat and launch the macro
In the file attached you can use a short cut to launch it: CONTROL + g
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks