Find value in column within last 90 days & populate listbox

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,731
Office Version
  1. 2007
Platform
  1. Windows
Morning,

On my worksheet i wish to look for the value TBA but only for the last 90 days
Any TBA found after 90 days can be ignored.

Here is how it should work,

In column G will be various values BUT i am looking for TBA only.
In column A will be a date.
In column B will be a Customers Name.

I would have a userform with Listbox1 & a command button.
The command button would run the code looking for TBA & Customers found within last 90 days would then appear in my Listbox.

Please can you advise Thanks
 
That gives me Type Mismatch

EaseUS_2024_10_24_18_29_39.jpg
 
Upvote 0

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Starts at Row 1 to current Row 2271
Thats why its limited from todays date & back 90 days so it doesnt look up all the way back to when it was started
 
Upvote 0
Try this.
POSTAGE TEST FILE

We are looking for DELIVERED NO SIG

Listbox to be populated from today & back 90 days.

Would also like to select value in listbox & customer then selected on worksheet

Thanks
 
Upvote 0
Your column A are not dates go back to post 3 and use this
VBA Code:
            If Date - DateValue(fndRng.Offset(, -6)) < 90 Then

Would also like to select value in listbox & customer then selected on worksheet
try
VBA Code:
Private Sub ListBox1_Click()
  Dim fndRng As Range
  Dim customer As String
  
  customer = ListBox1.List(ListBox1.ListIndex)
  
  With Sheets("POSTAGE").Range("B:B")
    Set fndRng = .Find(What:=customer, LookIn:=xlValues, LookAt:=xlWhole, _
        SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False)
    If Not fndRng Is Nothing Then fndRng.Select
  End With
  
  Unload RoyalMailClaim
End Sub
 
Upvote 0
Thanks for that.
Not sure what I was thinking when I said column A, maybe had another sheet open.

I will check this out tomorrow.
Thanks for the help & advice & sorry for wasting your time.
 
Upvote 0

Forum statistics

Threads
1,223,884
Messages
6,175,174
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top