ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro or VB code to hide and unhide Label box (https://www.excelbanter.com/excel-discussion-misc-queries/264064-macro-vbulletin-code-hide-unhide-label-box.html)

DeN

Macro or VB code to hide and unhide Label box
 
I need your help to create a macro or a Visual Basic code that do the
following: I have a cell with a macro that shows €śMeets€ť or €śDoes not Meets€ť
depending of the result of other cell. That Im trying to do is a macro or
visual basic code that display a Label box when €śMeets€ť is showed and hidden
it when €śDoes not Meet€ť is showed. I'm trying a VB code using the if
statement to change the visible property (to False and True) of the Label
box but is not working. I'm not very familiarized with visual basic and Im
not at the level of skills of many of you so please take that in
consideration for any suggestion.

Thanks in advance€¦


FSt1

Macro or VB code to hide and unhide Label box
 
hi
i use a label from the control toolbox for this.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Set Target = Range("A2") '<<<<<change to suit your data
If Target.Value = "meets" Then
Label1.Visible = True
Else
Label1.Visible = False
End If
End Sub

this is sheet code. right click the sheet tab and click view code. paste the
code in the code pane that comes up.

regards
FSt1

"Den" wrote:

I need your help to create a macro or a Visual Basic code that do the
following: I have a cell with a macro that shows €śMeets€ť or €śDoes not Meets€ť
depending of the result of other cell. That Im trying to do is a macro or
visual basic code that display a Label box when €śMeets€ť is showed and hidden
it when €śDoes not Meet€ť is showed. I'm trying a VB code using the if
statement to change the visible property (to False and True) of the Label
box but is not working. I'm not very familiarized with visual basic and Im
not at the level of skills of many of you so please take that in
consideration for any suggestion.

Thanks in advance€¦



All times are GMT +1. The time now is 05:18 PM.

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