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: 3
Default Need Help Creating a Loop

I am trying to avoid having to enter the following code 72 times (once
for each fo the 72 listboxes I have) in the worksheet:

Sheet1.ListBox1.AddItem "Select From List"
Sheet1.ListBox1.AddItem "1 (High Risk)"
Sheet1.ListBox1.AddItem "2"
Sheet1.ListBox1.AddItem "3"
Sheet1.ListBox1.AddItem "4"
Sheet1.ListBox1.AddItem "5 (Low Risk)"
If Sheet1.Range("B5") = "Select From List" Then
Sheet1.ListBox1.ListIndex = 0
End If
If Sheet1.Range("B5") = "1 (High Risk)" Then
Sheet1.ListBox1.ListIndex = 1
End If
If Sheet1.Range("B5") = "2" Then
Sheet1.ListBox1.ListIndex = 2
End If
If Sheet1.Range("B5") = "3" Then
Sheet1.ListBox1.ListIndex = 3
End If
If Sheet1.Range("B5") = "4" Then
Sheet1.ListBox1.ListIndex = 4
End If
If Sheet1.Range("B5") = "5 (Low Risk)" Then
Sheet1.ListBox1.ListIndex = 5
End If

Any help?

Thanks,

Jeff

 
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
creating a loop JakeShipley2008 Excel Discussion (Misc queries) 2 September 9th 08 02:17 PM
Creating a loop JakeShipley2008 Excel Discussion (Misc queries) 1 September 8th 08 10:26 PM
Creating a loop shart Excel Programming 10 December 21st 05 08:24 AM
Creating a loop Ibuprofen Excel Programming 1 October 26th 05 04:41 AM
Creating a For Loop Justin Ragsdale Excel Programming 5 May 23rd 04 10:40 PM


All times are GMT +1. The time now is 06:32 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"