Search Column, Return Row Number or "Not Found"

sd2173

New Member
Joined
Feb 16, 2011
Messages
31
I am trying to find out how I can enter a number on a form and search a column "A1" for that number, if a match is found I would like to know the row number so I can pull data from that rown to form.

If the number is not found I would like to know it was not found.

This seems like it should be simple.

I have tried to create an autofilter macro but since the result just hides other entries my info is not accessable through row 2 since it is still in its original position?

Any help appreciated!
SD
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Below is the code I tried using the autofilter option but like I said, it still copies the actual row from the filtered list. This means when I run my macro it disregards looking for the number I want to search for "idnum.text" and instead automatically copies from the row which was found in creating the macro using a different ID number to filter.

Any help is appreciated thanks.
SD

***************
'Sheets("StudentData").Select
'Selection.AutoFilter
'Selection.AutoFilter Field:=1, Criteria1:=idnum.Text, Operator:=xlAnd
'Range("A9:G9").Select
'Range("G9").Activate
'Selection.Copy
'Sheets("Sheet3").Select
'ActiveSheet.Paste

'searchrow.Caption = Sheets("Sheet3").Range("B1")

'Range("A1:G1").Select
'Range("G1").Activate
'Application.CutCopyMode = False
'Selection.ClearContents
'Range("A1").Select

'Sheets("StudentData").Select
'Selection.AutoFilter
'Range("A1").Select

'Sheets("Sheet1").Select
'Range("A1").Select
 
Upvote 0

Forum statistics

Threads
1,214,382
Messages
6,119,194
Members
448,874
Latest member
Lancelots

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