match in multiple colums

harts

Board Regular
Joined
Apr 5, 2011
Messages
111
Office Version
  1. 365
Platform
  1. Windows
I have written the following, that works good for what I had. I have a lot of information on the sheet so I decided to make another column so the sheet would not be so long. The I have tried to munipulate this formula to account for column G also but can't get it to work. All in all what I want to accomplish is a something that will lookup or match the caption in label1 in column A or G, then make that cell the activecell. Looking for any help at all. Thank you.


Dim l As Long
l = Application.WorksheetFunction.Match(Label1.Caption,
Range"A1:A300"), 0)
Range("A1").Offset(l - 1, 1).Select
ActiveCell = TextBox1.Value
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Try

Code:
Dim Found As Range
Set Found = Range("A1,G1").EntireColumn.Find(what:=Label1.Caption, LookIn:=xlValues, lookat:=xlWhole)
If Not Found Is Nothing Then
    Found.Select
Else
    MsgBox "not found", vbInformation
End If
 
Upvote 0

Forum statistics

Threads
1,224,517
Messages
6,179,233
Members
452,898
Latest member
Capolavoro009

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