ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How do I change a buttons contents depending on a cells contents? (https://www.excelbanter.com/excel-programming/323276-how-do-i-change-buttons-contents-depending-cells-contents.html)

Kosh42|EFG

How do I change a buttons contents depending on a cells contents?
 
I need to change the contents (and format if possible) depending on the
contents of a cell... If possible, the button would only display in certain
cells contained data.

Is this possible?

Thanks,

Tim

gocush[_29_]

How do I change a buttons contents depending on a cells contents?
 
some thing like this in the Sheet Object where the button is located:

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Range("C3") = "Hello" Then
ActiveSheet.Shapes("MyBtn").Visible = True
'vba seems to require selection before formatting, so:
ActiveSheet.Shapes("MyBtn").Select
With Selection.Font
.FontStyle = "Bold"
.Size = 10
.ColorIndex = 3
End With
Target.Select
Else
ActiveSheet.Shapes("MyBtn").Visible = False
End If
Application.EnableEvents = True
End Sub

"Kosh42|EFG" wrote:

I need to change the contents (and format if possible) depending on the
contents of a cell... If possible, the button would only display in certain
cells contained data.

Is this possible?

Thanks,

Tim


Kosh42|EFG[_2_]

How do I change a buttons contents depending on a cells conten
 
Makes sense...

Many thanks,

Tim


All times are GMT +1. The time now is 08:43 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com