Tony Barla
Thanks Tom,
That will help heaps. I was trying stuff like rowcount and rowsource etc.
Plus i wasn't referrencing the userform, just the listbox. hehe.
Greatly appreciated.
Tony B.
"Tom Ogilvy" wrote:
As long as you are starting in B1
dim r as Range
set r = Range("B1")(userform1.Listbox1.ListIndex + 1,2)
to explain
Range("B1")(1,2)
gives you C1 and Range("B1")(1,1) is B1
Range("B1")(4,2)
is cell C4
since Listbox1.Listindex is zero based, we add 1 to it to get the selected
item.
--
Regards,
Tom Ogilvy
"Tony Barla" wrote in message
...
Hi All,
I'm using the below code to fill a listbox from items in a range starting
from
cell B1. (Saw it the other day on these forums, from a question by Al...)
-------------------------------------
Private Sub UserForm_Initialize()
Dim r, c As Range
With Sheets("Sheet1")
Set r = .Range(.Range("B1"), .Range("B" & Rows.Count).End(xlUp))
For Each c In r
ListBox1.AddItem c
Next c
End With
End Sub
-------------------------------------
What i'm trying to do is depending on the item selected, modify the cell
next to it
from a text box on the same form.
So if item "CMS-D1" is selected from the list, ("CMS-D1" sits in cell B7),
i
need
to change cell C7 with what is is textbox1.
Im having problems getting the cell reference depending on the item
selected.
Any help would be appreciated.
Cheer.
Tony B.
|