View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Selecting a data range using a variable

I think you mean

ListBox1.RowSource = "'Worksheet1'$E$" & Variable1 & ":$E$" & Variable2


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Alariel" wrote in
message ...

Hi there...

I'm having a little trouble as I have never programmed excel but have
studied programming so I know what i'm doing but have no idea how to go
about it sometimes :P

I have not been able to track down a tutorial for my latest problem...

What I have so far is a combo box to select an employee name and a
button to sort the database so I only have rows containing that
employee name.

So in essence I am at the moment left with a set of rows looking like
for example:

1
56
57
58
59
1000

and I want to populate a list box with the contents of column E.

ie E56-E59

but of course it is not always 56-59 it could be 10-13.

Can I approach this along these lines?

ListBox1.RowSource = "'Worksheet1'$E$Variable$E$Variable2"

*edit*
Forgot my question :P

If so what syntax do i use with the variables so it knows to look for
$E$56 instead of $E$Variable.

*edit*

Or should I go about it completely differently? :)

Thoughs and advice appreciated.

D


--
Alariel
------------------------------------------------------------------------
Alariel's Profile:

http://www.excelforum.com/member.php...o&userid=37644
View this thread: http://www.excelforum.com/showthread...hreadid=572560