LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 150
Default User List Box - List from Hidden range - VBA worng

Hi All

not my code, but I would love to fix it. The rows.value(i+1,1) --
statements are wrong.

How is it fixed please.

'fills in list box. stops at first empty row in project list
Private Sub UserForm_Initialize()
Dim orange As Range, orow As Range
Set orange = ThisWorkbook.Names("Proj_range").RefersToRange
'load each into a list and sort ascending

Dim i As Long
ReDim list(orange.Rows.Count)
For i = 0 To orange.Rows.Count
If orange.Rows.Value(i + 1, 1) = "" Then Exit For
list(i).text = Trim(orange.Rows.Value(i + 1) & " (" &
orange.Rows.Value(i + 1) & ")")
list(i).id = orange.Rows.Value(i + 1)
Me.ListBox1.AddItem orow.Value(1) & " (" & orow.Value(1) & ")"
Next
ReDim Preserve list(i - 1)
sort list
For i = 0 To UBound(list)
Me.ListBox1.AddItem list(i).text
Next
proj_id = 0
End Sub

Stan
 
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
Data validation list decreases as the user chooses from the list/s Emdyey Excel Discussion (Misc queries) 1 September 9th 08 01:37 PM
List Box in User Form filled by Range Jez Excel Programming 0 May 11th 07 05:03 PM
data validation list: how do i 'force' a user to enter data from the list? showsomeidnow Excel Discussion (Misc queries) 4 May 1st 07 05:49 PM
data validation list: how do i 'force' a user to enter data from the list? showsomeidnow Excel Discussion (Misc queries) 2 April 29th 07 11:09 PM
Condensing a list/range with blank cells to a new list/range without blanks KR Excel Worksheet Functions 4 July 5th 05 04:23 PM


All times are GMT +1. The time now is 06:18 AM.

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

About Us

"It's about Microsoft Excel"