User Form cell colour change

paulsolar

Well-known Member
Joined
Aug 21, 2013
Messages
670
Office Version
  1. 365
Hi AllIs it possible to change the colour of a button in user form based on the content of a cell in a specific spread sheet?I have a user form that I'm using as an index to a workbook, what I would like to do is have the button "View Alerts & Access Excel" turn red if cell B5 in the alert sheet changes from "Nothing to report " to "Alert"I've tried to track this function down without sucessKind regardsPaul
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Hi All

In answer to my own question I had a go at a bit of code to change the colour

It isn't showing any error, but then again it isn't working either?

Any suggestions where I'm going wrong with this?

is it actually the back colour that changes the colour of the command button?

Kind regards

Paul


Code:
Private Sub Alert()


If Sheets("Alert").Range("e5").Value = "There is an alert" = True Then


CommandButton("viewexcel").BackColor = vbRed


End If


End Sub
 
Upvote 0

Forum statistics

Threads
1,213,543
Messages
6,114,236
Members
448,555
Latest member
RobertJones1986

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top