Related:
- Macro for fill color alternative rows
- Thaiphoon burner alternative - Download - Diagnosis and monitoring
- Notepad++ background color - Guide
- Sound card color code - Guide
- Rg45 color coding - Guide
- Powertoys color picker download - Download - Other
7 responses
venkat1926
Posts
1863
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
811
Aug 28, 2009 at 10:59 PM
Aug 28, 2009 at 10:59 PM
try this macro (this will color rows 2,4,6,8 etc red)
if you want rows 1,3,5,7 etc to be colored
change the following line in the above macro
If k Mod 2 = 0 Then
into
If k Mod 2 = 1 Then
Sub test() Dim j As Integer, k As Integer j = Range("a1").End(xlDown).Row 'j is the last row For k = 1 To j If k Mod 2 = 0 Then Cells(k, "a").EntireRow.Interior.ColorIndex = 3 End If Next k End Sub
if you want rows 1,3,5,7 etc to be colored
change the following line in the above macro
If k Mod 2 = 0 Then
into
If k Mod 2 = 1 Then
venkat1926
Posts
1863
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
811
Sep 1, 2009 at 08:07 PM
Sep 1, 2009 at 08:07 PM
quote
I want ALL THE UNHIDDEN rows to be colored.
unquote
why do you want to color the unhidden rows. it is always in front of you anyhow try this mcro
I want ALL THE UNHIDDEN rows to be colored.
unquote
why do you want to color the unhidden rows. it is always in front of you anyhow try this mcro
Sub test() Dim j As Integer, k As Integer j = Range("a1").End(xlDown).Row 'j is the last row For k = 1 To j If Rows(k).Hidden = False Then Cells(k, "a").EntireRow.Interior.ColorIndex = 3 End If Next k End Sub
Hi,
But, I want to fill color in selected range (any range), which rows are visible (Not Hidden). if my rows are 1 to 10, hidden rows 3 and 6, then visible rows 1,2,4,5,7,8,9,10. now I want to alternate color these visible rows.
But, I want to fill color in selected range (any range), which rows are visible (Not Hidden). if my rows are 1 to 10, hidden rows 3 and 6, then visible rows 1,2,4,5,7,8,9,10. now I want to alternate color these visible rows.
venkat1926
Posts
1863
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
811
Aug 31, 2009 at 05:22 AM
Aug 31, 2009 at 05:22 AM
contradiction between first message and laest one. first you want ALTERENATE ROWS to be colored. Now you want ALLTHE unhidden rows to be colored . please rephrase your question.
Didn't find the answer you are looking for?
Ask a question
venkat1926
Posts
1863
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
811
Jun 26, 2012 at 06:26 AM
Jun 26, 2012 at 06:26 AM
try this
Sub test() Dim j As Integer, k As Integer j = Range("a1").End(xlDown).Row 'j is the last row For k = 1 To j If Rows(k).Hidden = False Then 'Cells(k, "a").EntireRow.Interior.ColorIndex = 3 Range(Cells(k, "A"), Cells(k, Columns.Count).End(xlToLeft)).Cells.Interior.ColorIndex = 3 End If Next k End Sub
Sub Test()
Dim iNumOfRows As Integer, iStartFromRow As Integer, iCount As Integer
iNumOfRows = Range("D61").End(xlDown).Row '--- counts Rows down starting from D61
For iStartFromRow = 61 To iNumOfRows
If Rows(iStartFromRow).Hidden = False Then '--- only unhidden rows matter
iCount = iCount + 1
If iCount - 2 * Int(iCount / 2) = 0 Then
Rows(iStartFromRow).Interior.Color = RGB(220, 230, 241)
Else
Rows(iStartFromRow).Interior.Color = RGB(184, 204, 228)
End If
End If
Next iStartFromRow
End Sub
Dim iNumOfRows As Integer, iStartFromRow As Integer, iCount As Integer
iNumOfRows = Range("D61").End(xlDown).Row '--- counts Rows down starting from D61
For iStartFromRow = 61 To iNumOfRows
If Rows(iStartFromRow).Hidden = False Then '--- only unhidden rows matter
iCount = iCount + 1
If iCount - 2 * Int(iCount / 2) = 0 Then
Rows(iStartFromRow).Interior.Color = RGB(220, 230, 241)
Else
Rows(iStartFromRow).Interior.Color = RGB(184, 204, 228)
End If
End If
Next iStartFromRow
End Sub