Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default Listbox finding the adress of the item

Hi Everyone,
Lets say i have, listbox1,textbox1,textbox2 and commandbutton1 in
userform1. when i click on commandbutton1
Dim trddate As Variant
trddate = Date
For Each cell In reqd.Columns(1).Cells
If cell.Value = trddate Then
ListBox1.ColumnCount = 11
ListBox1.AddItem "PIT " & cell.Offset(0, 1).Value
ListBox1.List(ListBox1.ListCount - 1, 2) = cell.Offset(0, 2)
CPitUF.ListBox1.TextColumn = 9
End If
Next
whenever I click on Listbox1, listbox bound column will display on
textbox1 and listbox.text will display on textbox2. i want to find the
address of those items in the sheet(range of the item in the listbox)
so that every time i click on the list box that will find the address
of the item in the worksheet and type "X" on the offset(0,1). So is
there a way to display on textbox3 listbox column 11 value.List box as
follow
Column
1 2 3 4 5 6 7 8 9 10 11
A B C D E F G H I J K
So once I click on listbox
Textbox1=C, Textbox2= I and Textbox3=K

Is that possible?
Thanks for the help
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Listbox finding the adress of the item

Instead of having 11 columns in .listbox1, include a 12th column. Put the row
number (or address or whatever you want) in that 12th column. Then make sure
that the columnwidth for that 12th column is 0, so it's hidden.

Then you can just look at the column 12 whenever you need it.



" wrote:

Hi Everyone,
Lets say i have, listbox1,textbox1,textbox2 and commandbutton1 in
userform1. when i click on commandbutton1
Dim trddate As Variant
trddate = Date
For Each cell In reqd.Columns(1).Cells
If cell.Value = trddate Then
ListBox1.ColumnCount = 11
ListBox1.AddItem "PIT " & cell.Offset(0, 1).Value
ListBox1.List(ListBox1.ListCount - 1, 2) = cell.Offset(0, 2)
CPitUF.ListBox1.TextColumn = 9
End If
Next
whenever I click on Listbox1, listbox bound column will display on
textbox1 and listbox.text will display on textbox2. i want to find the
address of those items in the sheet(range of the item in the listbox)
so that every time i click on the list box that will find the address
of the item in the worksheet and type "X" on the offset(0,1). So is
there a way to display on textbox3 listbox column 11 value.List box as
follow
Column
1 2 3 4 5 6 7 8 9 10 11
A B C D E F G H I J K
So once I click on listbox
Textbox1=C, Textbox2= I and Textbox3=K

Is that possible?
Thanks for the help


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Listbox finding the adress of the item

And if you're using .rowsource to populate the listbox, you should know where
the range starts. You can adjust it by adding the .listindex to that row
number--discounting columnheads, too.

Dave Peterson wrote:

Instead of having 11 columns in .listbox1, include a 12th column. Put the row
number (or address or whatever you want) in that 12th column. Then make sure
that the columnwidth for that 12th column is 0, so it's hidden.

Then you can just look at the column 12 whenever you need it.

" wrote:

Hi Everyone,
Lets say i have, listbox1,textbox1,textbox2 and commandbutton1 in
userform1. when i click on commandbutton1
Dim trddate As Variant
trddate = Date
For Each cell In reqd.Columns(1).Cells
If cell.Value = trddate Then
ListBox1.ColumnCount = 11
ListBox1.AddItem "PIT " & cell.Offset(0, 1).Value
ListBox1.List(ListBox1.ListCount - 1, 2) = cell.Offset(0, 2)
CPitUF.ListBox1.TextColumn = 9
End If
Next
whenever I click on Listbox1, listbox bound column will display on
textbox1 and listbox.text will display on textbox2. i want to find the
address of those items in the sheet(range of the item in the listbox)
so that every time i click on the list box that will find the address
of the item in the worksheet and type "X" on the offset(0,1). So is
there a way to display on textbox3 listbox column 11 value.List box as
follow
Column
1 2 3 4 5 6 7 8 9 10 11
A B C D E F G H I J K
So once I click on listbox
Textbox1=C, Textbox2= I and Textbox3=K

Is that possible?
Thanks for the help


--

Dave Peterson


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default Listbox finding the adress of the item

On Jan 29, 7:24 am, Dave Peterson wrote:
And if you're using .rowsource to populate the listbox, you should know where
the range starts. You can adjust it by adding the .listindex to that row
number--discounting columnheads, too.



Dave Peterson wrote:

Instead of having 11 columns in .listbox1, include a 12th column. Put the row
number (or address or whatever you want) in that 12th column. Then make sure
that the columnwidth for that 12th column is 0, so it's hidden.


Then you can just look at the column 12 whenever you need it.


" wrote:


Hi Everyone,
Lets say i have, listbox1,textbox1,textbox2 and commandbutton1 in
userform1. when i click on commandbutton1
Dim trddate As Variant
trddate = Date
For Each cell In reqd.Columns(1).Cells
If cell.Value = trddate Then
ListBox1.ColumnCount = 11
ListBox1.AddItem "PIT " & cell.Offset(0, 1).Value
ListBox1.List(ListBox1.ListCount - 1, 2) = cell.Offset(0, 2)
CPitUF.ListBox1.TextColumn = 9
End If
Next
whenever I click on Listbox1, listbox bound column will display on
textbox1 and listbox.text will display on textbox2. i want to find the
address of those items in the sheet(range of the item in the listbox)
so that every time i click on the list box that will find the address
of the item in the worksheet and type "X" on the offset(0,1). So is
there a way to display on textbox3 listbox column 11 value.List box as
follow
Column
1 2 3 4 5 6 7 8 9 10 11
A B C D E F G H I J K
So once I click on listbox
Textbox1=C, Textbox2= I and Textbox3=K


Is that possible?
Thanks for the help


--


Dave Peterson


--

Dave Peterson


Thanks to your reply.Honestly I didn`t know that I can get
"listbox1.column(0)" value:)But I figured out after your reply,thank
you.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Remove Item from Listbox by Item Name Randy[_2_] Excel Programming 3 September 19th 07 02:36 PM
Double click item in Listbox to select item and close Listbox GusEvans Excel Programming 3 July 19th 07 12:36 PM
listbox add item Baha Excel Programming 0 December 8th 06 02:37 AM
Add item to listbox, but only if it is not already there. Mark Excel Programming 4 September 2nd 05 10:07 PM
The value of a ListBox Item TK Excel Programming 2 August 20th 04 06:17 AM


All times are GMT +1. The time now is 01:56 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"