View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Incidental Incidental is offline
external usenet poster
 
Posts: 226
Default View Listbox items in the Label

Hi Shahzad

Sorry for the late reply, i have had a look at your code and it works
fine if you declare SourceRange as a range you have SourceData
declared but it is not used within your code??

As for my own code i am unsure as to why it is not working for you but
it might help you understand what the code is doing if you create a
test userform and only use the basics (a listbox and 7 labels) all
with the default names, though the userform should be called UserForm1
and then step through the code 1 line at a time using the F8 key. If
you set your screen up to see both the userform and the VBE you can
watch what is happening though but you may not need or want to do that
it is entirely up to you.

As i said if you declare SourceRange as a range you should get your
code working, the error "Compile Error, Variable not defined" is
generated when using Option Explicit at the top of your code, this
checks your code at compile time to ensure all your variables are
correct among other things.

I hope this helps but if you need anything else or you would like me
to comment the code i posted originally then let me know.

Steve