J
jeff
When UF5 is shown, the sub below will chk to see if certain cells are
not empty. If not, it will show the caption for each of the command
buttons (maximum of 10). It works fine, but what I want now is for the
command button not to be shown at all if the same condition occurs. I
tried adding another line in the THEN part below, but neither worked.
Any suggestions?
Thanks
j.o.
Private Sub UserForm_Initialize()
Dim VSws As Worksheet
Set VSws = Sheets("Vehicle summary")
For i = 1 To 10
With Me.Controls("CommandButton" & i)
If VSws.Range("H" & i + 4).Value = "" Then
.Visible = False
‘********************************************
‘tried adding these 2 lines, but neither worked
‘Me.Controls("CommandButton" & i).Visible = False
'UserForm5.Me.("CommandButton" & i).Visible=False
‘********************************************
Else
.Caption = VSws.Range("M" & i + 4).Value
.Visible = True
End If
End With
Next
End Sub
not empty. If not, it will show the caption for each of the command
buttons (maximum of 10). It works fine, but what I want now is for the
command button not to be shown at all if the same condition occurs. I
tried adding another line in the THEN part below, but neither worked.
Any suggestions?
Thanks
j.o.
Private Sub UserForm_Initialize()
Dim VSws As Worksheet
Set VSws = Sheets("Vehicle summary")
For i = 1 To 10
With Me.Controls("CommandButton" & i)
If VSws.Range("H" & i + 4).Value = "" Then
.Visible = False
‘********************************************
‘tried adding these 2 lines, but neither worked
‘Me.Controls("CommandButton" & i).Visible = False
'UserForm5.Me.("CommandButton" & i).Visible=False
‘********************************************
Else
.Caption = VSws.Range("M" & i + 4).Value
.Visible = True
End If
End With
Next
End Sub