Q:

VBA Excel: Sub procedure to change caption in a UserForm control

I'm creating a user form that shows the value(numeric) of the last used cell in a column.
I'm just guessing on how to do it but it doesn't work, this is what I got:
Sub show()

UserForm1.show

'xTotal is the name of the label control and B4 is the column with a list of numbers:

UserForm1.xTotal.Caption = ThisWorkbook.Sheets("Sheet1").Range("b4").End(xlDown)

End Sub

I know this is elementary stuff, I would appreciate your help. Thanks.

A:

You can't set a caption to a range, which is what your code is doing (though not your intention). You must set the caption to the value of the range - 
UserForm1.xTotal.Caption = ThisWorkbook.Sheets("Sheet1").Range("b4").End(xlDown).Value
Userform1.Show

You'll also want to set the caption before showing the userform.

