Code for Interactive Dashboard Course
This code Changes the Background in 4 different colors
- Switch to the Visual Basic ALT + F11
- Insert a Module ALT >I>M
- Copy and Paste the codes here below then Close the VBE
- Create 4 shapes, format them & right-click and Assign Macros
- Test the functionality and save the file as .XLSM
Sub BlueBackground()
Range(“A1:Az120”).Interior.Color = RGB(0, 46, 138)
Range(“J2,Q2,J17,Q17”).Interior.Color = vbWhite
Range(“E17,L17,S17”).Font.Color = vbWhite
Range(“A1”).Select
End Sub
Sub RedBackground()
Range(“A1:Az120”).Interior.Color = RGB(116, 0, 0)
Range(“J2,Q2,J17,Q17”).Interior.Color = vbWhite
Range(“E17,L17,S17”).Font.Color = vbWhite
Range(“A1”).Select
End Sub
Sub GreyBackground()
Range(“A1:Az120”).Interior.Color = RGB(217, 217, 217)
Range(“J2,Q2,J17,Q17”).Interior.Color = vbWhite
Range(“E17,L17,S17”).Font.Color = vbBlack
Range(“A1”).Select
End Sub
Sub WhiteBackground()
Range(“A1:Az120”).Interior.Color = vbWhite
Range(“J2,Q2,J17,Q17”).Interior.Color = RGB(217, 217, 217)
Range(“E17,L17,S17”).Font.Color = vbBlack
Range(“A1”).Select
End Sub
On the View Tab: Uncheck the Gridlines, Formula Bar, Headings
Drag the Horizontal Scroll Bar to cover all sheets