Phil Payne
Board Regular
- Joined
- May 17, 2013
- Messages
- 131
- Office Version
- 365
- Platform
- Windows
Hello,
i have a worksheet with 6 Rectangles that launch macros.
I am tryng to set them up so the user can tell which rectangle was last activated, i.e. change the activated rectangle button colour to say yellow and the others remain or return to a 'default' colour - grey.
II achieved this when using Command Buttons but as they were calling 'Custom Views' the buttons would disappear for a while along with much of the data. All would be restored to normal but it took some time.
Part of the command button code:-
The next Rectangles Custom View VBA (FY24_25) would have line 2 Yellow and line one grey.
I have the code written presenting the views but I'm stuck with changing the colours. I'm trying to get this Rectangle to change to yellow but I keep getting syntax errors.
I hope someone can help.
Thanks.
i have a worksheet with 6 Rectangles that launch macros.
I am tryng to set them up so the user can tell which rectangle was last activated, i.e. change the activated rectangle button colour to say yellow and the others remain or return to a 'default' colour - grey.
II achieved this when using Command Buttons but as they were calling 'Custom Views' the buttons would disappear for a while along with much of the data. All would be restored to normal but it took some time.
Part of the command button code:-
VBA Code:
Private Sub CommandButton1_click()
ActiveWorkbook.CustomViews("FY23_24").Show
ActiveSheet.CommandButton1.BackColor = RGB(255, 255, 0) 'YELLOW
ActiveSheet.CommandButton2.BackColor = &HC0C0C0 'grey
ActiveSheet.CommandButton3.BackColor = &HC0C0C0 'grey
ActiveSheet.CommandButton4.BackColor = &HC0C0C0 'grey
ActiveSheet.CommandButton5.BackColor = &HC0C0C0 'grey
ActiveSheet.CommandButton6.BackColor = &HC0C0C0 'grey
Range("A1").Select
End Sub
The next Rectangles Custom View VBA (FY24_25) would have line 2 Yellow and line one grey.
I have the code written presenting the views but I'm stuck with changing the colours. I'm trying to get this Rectangle to change to yellow but I keep getting syntax errors.
VBA Code:
Sub FY23_24()
' FY23_24 Macro
ActiveSheet.Shapes.Range(Array("Rectangle 1")).Select
Selection.OnAction = "FY23_24"
ActiveWorkbook.CustomViews("FY23_24").Show
[B][U]ActiveSheet.Rectangle 1.Color = RGB(255, 255,000)[/U][/B] 'yellow
End Sub
I hope someone can help.
Thanks.