find and update

Av8tordude

Well-known Member
Joined
Oct 13, 2007
Messages
1,075
Office Version
  1. 2019
Platform
  1. Windows
this code to search with in range and update the information. I have only 1 item in the range and it says there is nothing? Can someone assist to correct this problem.

Thank you

Code:
        SearchString = ListBox1.Column(1, ListBox1.ListIndex)        Set SearchRange = Range("T18:T" & LRow).Find(SearchString, LookIn:=xlValues, lookat:=xlWhole)
        
        EE = True
        If Not SearchRange Is Nothing Then
            SearchRange.Offset(0, -1).Value = Format(tbDate, "mm/dd/yyyy")
            SearchRange.Offset(0, 0).Value = lbTID
            SearchRange.Offset(0, 1).Value = CDbl(Amnt)
        End If
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
hi,
as far as I can see, nothing wrong with your code but wonder if you are returning the correct value from your listbox to your search variable

Rich (BB code):
SearchString = ListBox1.Column(1, ListBox1.ListIndex)

If the value you want to search for in your listbox is in the FIRST column you see, then the column number shown in red should be 0 (zero)

Dave
 
Upvote 0
I have a worksheet with data on it. It works just fine, however starting with a fresh sheet, I get the error. To answer your question, I only have 3 columns in the listbox. However, when i replace that part of the code with the actual text, still get an error.
 
Upvote 0
I have a worksheet with data on it. It works just fine, however starting with a fresh sheet, I get the error. To answer your question, I only have 3 columns in the listbox. However, when i replace that part of the code with the actual text, still get an error.

I should have also stated that your search range is unqualified - the sheet you are seraching will need to be the active sheet - if this is not possible then qualify the range to the required sheet

If still having issues, then place copy of your workbook with sample data in dropbox - I or others here may be able to resolve.

Dave
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,632
Latest member
jladair

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