Forum Discussion
Vimal_Gaur
Jan 23, 2023Brass Contributor
VBA Background color
VBA - Need shortcut key to change background color of ENTIRE row of active cell It should also change background color of ENTIRE rows of active / selected cells
- Jan 24, 2023
Sub colorseveralwows() Dim i As Long Dim bereich As Range Set bereich = Selection For i = bereich.Row To bereich.Row + bereich.Rows.Count - 1 Rows(i).Interior.Color = vbBlue Next i End Sub
You can run this code with the shortcut ctrl+B in the attached file. The macros colors rows 7, 8 and 9 blue if you select e.g. cells F7, F8 and F9.
NikolinoDE
Jan 23, 2023Gold Contributor
I can't offer you a solution with a key combination...I don't know how :).
But with a button you can insert it very easily and quickly.
Attached is the VBA solution with a button. Example file is included.
Sub N_colour()
[a1].Interior.ColorIndex = 5
End Sub
Hope I was able to help you with this info.
I know I don't know anything (Socrates)
Vimal_Gaur
Jan 23, 2023Brass Contributor
Thanks for your reply.
My Dear I said ENTIRE ROW & not a SINGLE CELL
My Dear I said ENTIRE ROW & not a SINGLE CELL