![]() |
Cell = "YES" then CommandButton2 Visible
Any assistance is appreciated!
I need a code which will make the commandbutton2 visible if cell "d18" is YES. Any ideas? |
Cell = "YES" then CommandButton2 Visible
Press Alt + F11 to open the Visual Basic Editor. In the project window,
under MICROSOFT EXCEL OBJECTS double click the workseet that has the command buttons. In the worksheet module add the following event code: Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Range("D18").Value = "Yes" Then Me.CommandButton2.Visible = True Else Me.CommandButton2.Visible = False End If End Sub -- Kevin Backmann "cru" wrote: Any assistance is appreciated! I need a code which will make the commandbutton2 visible if cell "d18" is YES. Any ideas? |
Cell = "YES" then CommandButton2 Visible
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$D$18" Then If UCase(Target.Value) = "YES" Then CommandButton2.Visible = True else CommandButton2.Visible = false End If End If End Sub "cru" wrote: Any assistance is appreciated! I need a code which will make the commandbutton2 visible if cell "d18" is YES. Any ideas? |
Cell = "YES" then CommandButton2 Visible
Hi Kevin,
Thank you so much! Cru "Kevin B" wrote: Press Alt + F11 to open the Visual Basic Editor. In the project window, under MICROSOFT EXCEL OBJECTS double click the workseet that has the command buttons. In the worksheet module add the following event code: Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Range("D18").Value = "Yes" Then Me.CommandButton2.Visible = True Else Me.CommandButton2.Visible = False End If End Sub -- Kevin Backmann "cru" wrote: Any assistance is appreciated! I need a code which will make the commandbutton2 visible if cell "d18" is YES. Any ideas? |
Cell = "YES" then CommandButton2 Visible
I think you will have better luck in the Worksheet Change Event
"cru" wrote: Hi Kevin, Thank you so much! Cru "Kevin B" wrote: Press Alt + F11 to open the Visual Basic Editor. In the project window, under MICROSOFT EXCEL OBJECTS double click the workseet that has the command buttons. In the worksheet module add the following event code: Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Range("D18").Value = "Yes" Then Me.CommandButton2.Visible = True Else Me.CommandButton2.Visible = False End If End Sub -- Kevin Backmann "cru" wrote: Any assistance is appreciated! I need a code which will make the commandbutton2 visible if cell "d18" is YES. Any ideas? |
Cell = "YES" then CommandButton2 Visible
A shorter routine...
Private Sub Worksheet_Change(ByVal Target As Range) CommandButton1.Visible = (Range("D18").Value = "YES") End Sub Note that the above is case-sensitive; here is a non-case-sensitive routine... Private Sub Worksheet_Change(ByVal Target As Range) CommandButton1.Visible = (UCase(Range("D18").Value) = "YES") End Sub -- Rick (MVP - Excel) "cru" wrote in message ... Any assistance is appreciated! I need a code which will make the commandbutton2 visible if cell "d18" is YES. Any ideas? |
Cell = "YES" then CommandButton2 Visible
I originally used the following code use macro (excluding if condition):
Sub Print_Preview_InputForm12() ' ' Print_Preview Macro ' Dim Answer As String Sheets("Ltr1").Visible = True Sheets("Ltr1").Select Range("A1:K48").Select ActiveSheet.PageSetup.PrintArea = Selection.Address ActiveSheet.PrintPreview Sheets("Print Ctr").Select End Sub Is there a way to insert the code into the above code so that if "d18" = "yes" the button will be visible? Thanks, cru "Mike" wrote: Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$D$18" Then If UCase(Target.Value) = "YES" Then CommandButton2.Visible = True else CommandButton2.Visible = false End If End If End Sub "cru" wrote: Any assistance is appreciated! I need a code which will make the commandbutton2 visible if cell "d18" is YES. Any ideas? |
Cell = "YES" then CommandButton2 Visible
Just add this line to your macro...
CommandButton2.Visible = (Range("D18").Value = "YES" -- Rick (MVP - Excel) "cru" wrote in message ... I originally used the following code use macro (excluding if condition): Sub Print_Preview_InputForm12() ' ' Print_Preview Macro ' Dim Answer As String Sheets("Ltr1").Visible = True Sheets("Ltr1").Select Range("A1:K48").Select ActiveSheet.PageSetup.PrintArea = Selection.Address ActiveSheet.PrintPreview Sheets("Print Ctr").Select End Sub Is there a way to insert the code into the above code so that if "d18" = "yes" the button will be visible? Thanks, cru "Mike" wrote: Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$D$18" Then If UCase(Target.Value) = "YES" Then CommandButton2.Visible = True else CommandButton2.Visible = false End If End If End Sub "cru" wrote: Any assistance is appreciated! I need a code which will make the commandbutton2 visible if cell "d18" is YES. Any ideas? |
Cell = "YES" then CommandButton2 Visible
I really should have filtered the change event. For the case-sensitive
version... Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$D$18" Then CommandButton1.Visible = (Target.Value = "YES") End If End Sub For the non-case-sensitive version... Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$D$18" Then CommandButton1.Visible = (UCase(Target.Value) = "YES") End If End Sub -- Rick (MVP - Excel) "Rick Rothstein" wrote in message ... A shorter routine... Private Sub Worksheet_Change(ByVal Target As Range) CommandButton1.Visible = (Range("D18").Value = "YES") End Sub Note that the above is case-sensitive; here is a non-case-sensitive routine... Private Sub Worksheet_Change(ByVal Target As Range) CommandButton1.Visible = (UCase(Range("D18").Value) = "YES") End Sub -- Rick (MVP - Excel) "cru" wrote in message ... Any assistance is appreciated! I need a code which will make the commandbutton2 visible if cell "d18" is YES. Any ideas? |
Cell = "YES" then CommandButton2 Visible
Rick,
How can I incorporate the code you have to the following code: Sub Print_Preview_InputForm12() ' ' Print_Preview Macro ' Dim Answer As String Sheets("Ltr1").Visible = True Sheets("Ltr1").Select Range("A1:K48").Select ActiveSheet.PageSetup.PrintArea = Selection.Address ActiveSheet.PrintPreview Sheets("Print Ctr").Select End Sub I currently have this but if I can incorporate your code into the above code then I wanted to see if I can eliminate from creating commandbutton. Thanks. cru "Rick Rothstein" wrote: I really should have filtered the change event. For the case-sensitive version... Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$D$18" Then CommandButton1.Visible = (Target.Value = "YES") End If End Sub For the non-case-sensitive version... Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$D$18" Then CommandButton1.Visible = (UCase(Target.Value) = "YES") End If End Sub -- Rick (MVP - Excel) "Rick Rothstein" wrote in message ... A shorter routine... Private Sub Worksheet_Change(ByVal Target As Range) CommandButton1.Visible = (Range("D18").Value = "YES") End Sub Note that the above is case-sensitive; here is a non-case-sensitive routine... Private Sub Worksheet_Change(ByVal Target As Range) CommandButton1.Visible = (UCase(Range("D18").Value) = "YES") End Sub -- Rick (MVP - Excel) "cru" wrote in message ... Any assistance is appreciated! I need a code which will make the commandbutton2 visible if cell "d18" is YES. Any ideas? |
Cell = "YES" then CommandButton2 Visible
Just add this line to your macro...
CommandButton2.Visible = (Range("D18").Value = "YES") -- Rick (MVP - Excel) "cru" wrote in message ... Rick, How can I incorporate the code you have to the following code: Sub Print_Preview_InputForm12() ' ' Print_Preview Macro ' Dim Answer As String Sheets("Ltr1").Visible = True Sheets("Ltr1").Select Range("A1:K48").Select ActiveSheet.PageSetup.PrintArea = Selection.Address ActiveSheet.PrintPreview Sheets("Print Ctr").Select End Sub I currently have this but if I can incorporate your code into the above code then I wanted to see if I can eliminate from creating commandbutton. Thanks. cru "Rick Rothstein" wrote: I really should have filtered the change event. For the case-sensitive version... Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$D$18" Then CommandButton1.Visible = (Target.Value = "YES") End If End Sub For the non-case-sensitive version... Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$D$18" Then CommandButton1.Visible = (UCase(Target.Value) = "YES") End If End Sub -- Rick (MVP - Excel) "Rick Rothstein" wrote in message ... A shorter routine... Private Sub Worksheet_Change(ByVal Target As Range) CommandButton1.Visible = (Range("D18").Value = "YES") End Sub Note that the above is case-sensitive; here is a non-case-sensitive routine... Private Sub Worksheet_Change(ByVal Target As Range) CommandButton1.Visible = (UCase(Range("D18").Value) = "YES") End Sub -- Rick (MVP - Excel) "cru" wrote in message ... Any assistance is appreciated! I need a code which will make the commandbutton2 visible if cell "d18" is YES. Any ideas? |
Cell = "YES" then CommandButton2 Visible
What is it your trying to do with the commandbutton ? I have no clue....
"cru" wrote: Rick, How can I incorporate the code you have to the following code: Sub Print_Preview_InputForm12() ' ' Print_Preview Macro ' Dim Answer As String Sheets("Ltr1").Visible = True Sheets("Ltr1").Select Range("A1:K48").Select ActiveSheet.PageSetup.PrintArea = Selection.Address ActiveSheet.PrintPreview Sheets("Print Ctr").Select End Sub I currently have this but if I can incorporate your code into the above code then I wanted to see if I can eliminate from creating commandbutton. Thanks. cru "Rick Rothstein" wrote: I really should have filtered the change event. For the case-sensitive version... Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$D$18" Then CommandButton1.Visible = (Target.Value = "YES") End If End Sub For the non-case-sensitive version... Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$D$18" Then CommandButton1.Visible = (UCase(Target.Value) = "YES") End If End Sub -- Rick (MVP - Excel) "Rick Rothstein" wrote in message ... A shorter routine... Private Sub Worksheet_Change(ByVal Target As Range) CommandButton1.Visible = (Range("D18").Value = "YES") End Sub Note that the above is case-sensitive; here is a non-case-sensitive routine... Private Sub Worksheet_Change(ByVal Target As Range) CommandButton1.Visible = (UCase(Range("D18").Value) = "YES") End Sub -- Rick (MVP - Excel) "cru" wrote in message ... Any assistance is appreciated! I need a code which will make the commandbutton2 visible if cell "d18" is YES. Any ideas? |
Cell = "YES" then CommandButton2 Visible
Sorry Mike...
My goal is to have the command button to fire off the following sequence. 1. If D18 = Yes; 2. Button be visible for Print Preview 3. Upon pressing the button 2. Open hidden Ltr1 tab 3. Preview Ltr1 tab 4. If D18 = No; 3. Button be hidden I apologize for the vague question and I do appreciate your help. Thanks. cru "Mike" wrote: What is it your trying to do with the commandbutton ? I have no clue.... "cru" wrote: Rick, How can I incorporate the code you have to the following code: Sub Print_Preview_InputForm12() ' ' Print_Preview Macro ' Dim Answer As String Sheets("Ltr1").Visible = True Sheets("Ltr1").Select Range("A1:K48").Select ActiveSheet.PageSetup.PrintArea = Selection.Address ActiveSheet.PrintPreview Sheets("Print Ctr").Select End Sub I currently have this but if I can incorporate your code into the above code then I wanted to see if I can eliminate from creating commandbutton. Thanks. cru "Rick Rothstein" wrote: I really should have filtered the change event. For the case-sensitive version... Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$D$18" Then CommandButton1.Visible = (Target.Value = "YES") End If End Sub For the non-case-sensitive version... Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$D$18" Then CommandButton1.Visible = (UCase(Target.Value) = "YES") End If End Sub -- Rick (MVP - Excel) "Rick Rothstein" wrote in message ... A shorter routine... Private Sub Worksheet_Change(ByVal Target As Range) CommandButton1.Visible = (Range("D18").Value = "YES") End Sub Note that the above is case-sensitive; here is a non-case-sensitive routine... Private Sub Worksheet_Change(ByVal Target As Range) CommandButton1.Visible = (UCase(Range("D18").Value) = "YES") End Sub -- Rick (MVP - Excel) "cru" wrote in message ... Any assistance is appreciated! I need a code which will make the commandbutton2 visible if cell "d18" is YES. Any ideas? |
All times are GMT +1. The time now is 09:41 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com