Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
cru cru is offline
external usenet poster
 
Posts: 9
Default 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?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,316
Default 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?

  #3   Report Post  
Posted to microsoft.public.excel.programming
cru cru is offline
external usenet poster
 
Posts: 9
Default 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?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default 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?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default 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?



  #6   Report Post  
Posted to microsoft.public.excel.programming
cru cru is offline
external usenet poster
 
Posts: 9
Default 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?

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default 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?


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default 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?


  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default 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?



  #10   Report Post  
Posted to microsoft.public.excel.programming
cru cru is offline
external usenet poster
 
Posts: 9
Default 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?






  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default 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?





  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default 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?




  #13   Report Post  
Posted to microsoft.public.excel.programming
cru cru is offline
external usenet poster
 
Posts: 9
Default 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?




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
Empty a cell if the values equal to "IN" , "MC" or "PP" YHT Excel Programming 1 December 28th 07 06:59 AM
Help!!! Enter "7" in a cell and Excel changes the "7" to "11" immediately!!! [email protected] Excel Discussion (Misc queries) 3 January 5th 07 02:18 PM
VBA to address first visible cell in Column "D" after filtering EagleOne Excel Discussion (Misc queries) 2 December 11th 06 05:22 PM
Complex if test program possible? If "value" "value", paste "value" in another cell? jseabold Excel Discussion (Misc queries) 1 January 30th 06 10:01 PM


All times are GMT +1. The time now is 04:46 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"