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: 371
Default Adding and Reading a ListBox Item

Hi,
I populate a 2 column, MultiSelectMulti, ListBox on a form with worksheet
names which have data like so:

If Sheets(i).Cells(rnum, cnum).Value 0 Then
frmExport.lboSelectWeek.AddItem Sheets(i).Name
End If

The aim then is to select any number of sheets and copy paste the data to
another file. This I can manage ok. The problem arises when I try to
prevent a repeat copy paste of the same data.
To do this, after each sheet has been copied, a visual indicator is added to
the ListBox row and column of the sheet selected. The abbreviated code is:

For i = 0 To frmExport.lboSelectWeek.ListCount - 1

If frmExport.lboSelectWeek.Selected(i) = True Then
''*************

''< Do copy and paste to other workbook stuff

frmExport.lboSelectWeek.List(i, 1) = "Done" 'put an
indicator in

End If

Next

I would now like to prevent a repeat copy paste of the same data - even
though there is an indicator 'done'. The reason is, I have a 'Select All'
checkbox.

I have tried to trap this possibility by substituting the line marked
************* with:

If frmExport.lboSelectWeek.Selected(i) = True And Not
frmExport.lboSelectWeek.List(i,1)= "Done" Then

but get an error.

Curiously, if I insert a message box to read the item like so:

MsgBox frmExport.lboSelectWeek.List(i, 0) & vbCr & _
frmExport.lboSelectWeek.List(i, 1)

The msgbox reads both items correctly. Where am I going wrong?

I would very much appreciate some advice.

Geoff
 
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
Last Item of Listbox not getting displayed Raj Excel Discussion (Misc queries) 0 April 22nd 08 10:58 AM
Adding item in listbox volabos Excel Worksheet Functions 0 December 3rd 07 11:47 AM
Adding item in listbox volabos Excel Worksheet Functions 0 December 3rd 07 11:27 AM
Item order in ListBox [email protected] Excel Discussion (Misc queries) 1 June 16th 06 01:15 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 08:16 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"