View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
David Goodall David Goodall is offline
external usenet poster
 
Posts: 21
Default Userform Label question

Tom
Thank you very much.
David




Tom Ogilvy wrote:
sub commandbutton_click()
Static count as integer
dim lablename as string

if count = 0 then _
count = 1

if count 10 then
count = 1
lablename = CStr(count) ' I thought I would need to cast the variable

Userform1.Controls("Lb" & lablename).caption = cblist.text

count = count + 1
End Sub


or if you want the same value placed in all labels:


sub commandbutton_click()
Dim c count as integer
dim lablename as string

for count = 1 to 10

lablename = CStr(count) ' I thought I would need to cast the variable

Userform1.Controls("Lb" & lablename).caption = cblist.text

Next

End Sub