Search Function Macro not working

skittlz

New Member
Joined
Oct 26, 2012
Messages
34
Office Version
  1. 365
Platform
  1. Windows
I used VBA to record a "searching" macro, and posted it into my larger code - but it doesn't seem to be working.

VBA Code:
    Set aCell = Sheets("DropDowns").Columns("J:K").Find(What:=Asset, After:="a1", LookIn:=xlFormulas2, _
        LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
        MatchCase:=False, SearchFormat:=False)

currentSN = Trim(aCell.Offset(0, 1))
MsgBox currentSN

Basically - the macro is saying go to "Dropdowns" tab, search in Column J:K for a Asset (string), offset cells by 1 row and store value. I'm using MsgBox to verify it got the right value. I cant figure out why its not working - any ideas?
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Why would your After be
VBA Code:
After:="a1"
When you are searching columns J and K?
 
Upvote 0
Solution

Forum statistics

Threads
1,223,060
Messages
6,169,861
Members
452,286
Latest member
noclue2000

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