PDA

View Full Version : CommandBox duel command?



selraith
11-13-2007, 05:17 AM
Hi is it possible to have the commandbox to do the following:
when the user clicks on the command box it will say create advertisement list - this will unhide some rows and then once it has been clicked the commandbox will then say close advertisement - this will then hide the rows that have the advertisement.

Bob Phillips
11-13-2007, 05:21 AM
You can hide rows or columns, not cells.

What is the rationale for hiding them?

selraith
11-13-2007, 05:52 AM
You can hide rows or columns, not cells.

What is the rationale for hiding them?

sorry your rite i mean hiding the rows.. not the cells my bad is it possible havinng a duel command on a commandbox? so it will hiide and then unhide with a second click and the porcess will continue?

Bob Phillips
11-13-2007, 07:36 AM
Private Sub ComboBox1_Change()
Static mpReEntry As Boolean
If Not mpReEntry Then
mpReEntry = True
With Me.ComboBox1
If .Value = "Create Advertisement List" Then
ActiveSheet.Rows("3:7").Hidden = False
.Clear
.AddItem "Close Advertisement List"
Else
ActiveSheet.Rows("3:7").Hidden = True
.Clear
.AddItem "Create Advertisement List"
End If
End With
mpReEntry = False
End If
End Sub

selraith
11-13-2007, 07:43 AM
is it possible having it as a Commandbutton

Bob Phillips
11-13-2007, 09:28 AM
Private Sub CommandButton1_Click()
Static mpReEntry As Boolean
If Not mpReEntry Then
mpReEntry = True
With Me.CommandButton1
If .Caption = "Create Advertisement List" Then
ActiveSheet.Rows("3:7").Hidden = False
.Caption = "Close Advertisement List"
Else
ActiveSheet.Rows("3:7").Hidden = True
.Caption = "Create Advertisement List"
End If
End With
mpReEntry = False
End If
End Sub

Private Sub UserForm_Activate()
With Me.CommandButton1
.Caption = "Create Advertisement List"
End With
End Sub

selraith
11-13-2007, 04:38 PM
[Code]

Private Sub CommandButton1_Click()
Static mpReEntry As Boolean
If Not mpReEntry Then
mpReEntry = True
With Me.CommandButton1
If .Caption = "Create Advertisement List" Then
ActiveSheet.Rows("3:7").Hidden = False
.Caption = "Close Advertisement List"
Else
ActiveSheet.Rows("3:7").Hidden = True
.Caption = "Create Advertisement List"
End If
End With
mpReEntry = False
End If
End Sub

Private Sub UserForm_Activate()
With Me.CommandButton1
.Caption = "Create Advertisement List"
End With
End Sub
[/vba]

Thanks dude it works brilliant !! Drinks on me i guess :beerchug:

Bob Phillips
11-13-2007, 04:39 PM
I'm not coming to bloody Antarctica to get them.

selraith
11-14-2007, 01:32 AM
I'm not coming to bloody Antarctica to get them.
just tell the bartender that selraith goes drinks on him :rotlaugh: