LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Little Closer, I think to Gaining the Column A Value

It looks like you find each non-empty cell in column A (myrow)

then you look to the previous row (myrow - 1) and see if the cell in column
B is equal to the value in Listbox1 and the cell in column F is equal to the
value in Listbox2

if so, then you loop from myrow + 2 to myrow + 22 and if a cell in column
3 is numeric, does not have a strike through font and is greater than or
equal to the value in the textbox, it is added to listbox3.

for your command button to work, you would have to find that same reference
row (myrow) and work from there. It doesn't do that now - it loops through
all the data in column C - and since you say data values can have duplicates,
it would not restrict itself to the items in Listbox3. I think the easiest
would be to add a hidden column in listbox3 that records what ever
information you want to show in label7 and when the selection is made in
listbox3, just extract that from the list. Or you could use a hidden column
to record the row number of the elements in listbox3.

If you need help with that, then I would probably need you to send me the
workbook.



--
Regards,
Tom Ogilvy


"Corey" wrote:

Not really sure if this will make things easier or more difficult to solve,
but the following code is what populates Listbox3.
It When selected it may be easier to get Label7 to display the Column A value in this code(??) than
by pressing a CommandButton?
I do not know.

Private Sub TextBox1_Change()
Application.ScreenUpdating = False
ListBox3.Clear
If TextBox1.Value < "" Then
Dim lastcell As Long
Dim myrow As Long
Dim i As Long
On Error Resume Next
lastcell = Worksheets("InspectionData").Cells(Rows.Count, "A").End(xlUp).Row
With ActiveWorkbook.Worksheets("InspectionData")
For myrow = 1 To lastcell
If .Cells(myrow, 1) < "" Then
If .Cells(myrow, 1).Offset(-1, 2).Value = ListBox1.Value Then
If .Cells(myrow, 1).Offset(-1, 6).Value = ListBox2.Value Then
For i = 2 To 22
If .Cells(myrow, 3).Offset(i, 0).Font.Strikethrough = False Then
If Cells(myrow, 3).Offset(i, 0).Value < "" Then
If IsNumeric(.Cells(myrow, 3).Offset(i, 0)) Then
If .Cells(myrow, 3).Offset(i, 0).Value < "" And .Cells(myrow, 3).Offset(i, 0).Value =
Val(TextBox1.Value) Then
ListBox3.AddItem Cells(myrow, 3).Offset(i, 0)
ListBox3.List(ListBox3.ListCount - 1, 1) = Cells(myrow, 3).Offset(i, 0).Address

End If
End If
End If
End If
Next i
End If
End If
End If
Next
End With
End If
Label8 = ListBox3.ListCount
Application.ScreenUpdating = True
End Sub


Corey....



 
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
divide column(x) by column(y) to give column(x/y) in excel? James New Users to Excel 2 April 24th 23 11:46 AM
Referencing date column A & time column B to get info from column TVGuy29 Excel Discussion (Misc queries) 1 January 24th 08 09:50 PM
Based on a condition in one column, search for a year in another column, and display data from another column in the same row look [email protected] Excel Programming 2 December 30th 06 06:23 PM
Based on a condition in one column, search for a year in another column, and display data from another column in the same row look [email protected] Excel Discussion (Misc queries) 1 December 27th 06 05:47 PM
How can i have all alike product codes in column A be matched with like cities in column B and then add the totals that are in column C [email protected] Excel Programming 4 August 2nd 06 01:10 AM


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