Command button caption from cell value
paste this code behind your form:
Private Sub UserForm_Initialize()
For i = 1 To 5
With ActiveSheet
Me.Controls("CommandButton" & i).Caption = _
.Range("L" & i + 4).Value
End With
Next
End Sub
--
jb
" wrote:
I'm trying to have 6 command buttons within a userform show a cell
range when the userform comes up. I've put this code in the UF module.
When I bring up the UF, nothing shows. Do I have to change a setting
in the UF properties? Thanks, jeff
Private Sub UserForm_Click()
CommandButton1.Caption = Range("L5").Value
CommandButton2.Caption = Range("L6").Value
CommandButton3.Caption = Range("L7").Value
CommandButton4.Caption = Range("L8").Value
CommandButton5.Caption = Range("L9").Value
CommandButton6.Caption = Range("L10").Value
End Sub
|