Excel Gurus!! Need a macro to find and assign

R

radlee

I am looking for a macro that will find a value (6-12 digit number) in
column A that will then place the cursor in the adjacent cell in
column B. I am planning on adding barcodes to items in our tool
crib. I want to be able to scan the crib item and have the macro
locate that item number in column A, and place my cursor in column B.
I will then scan their badge barcode into column b, thus assigning
them the tool. I will repeat the scanning process and reassign the
item to the crib (via barcode) once they return.

Thanks in advance!
 
R

Ron de Bruin

Try something like this

Sub Find_First()
Dim FindString As String
Dim Rng As Range
FindString = InputBox("Enter a Search value")
If Trim(FindString) <> "" Then
With Sheets("Sheet1").Range("A:A")
Set Rng = .Find(What:=FindString, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not Rng Is Nothing Then
Application.Goto Rng, True
Rng.Offset(0, 1).Select
Else
MsgBox "Nothing found"
End If
End With
End If
End Sub
 
R

radlee

THANKS!!! Worked perfectly!!!

Lee




Try something like this

Sub Find_First()
Dim FindString As String
Dim Rng As Range
FindString = InputBox("Enter a Search value")
If Trim(FindString) <> "" Then
With Sheets("Sheet1").Range("A:A")
Set Rng = .Find(What:=FindString, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not Rng Is Nothing Then
Application.Goto Rng, True
Rng.Offset(0, 1).Select
Else
MsgBox "Nothing found"
End If
End With
End If
End Sub
 
R

radlee

THANKS!!! Worked perfectly!!!
Tried to figure this out on my own, but i can't seem to get the right
combination. If I wanted to keep this macro looping until I hit cancel
on the 1st pop-up. How would the code be modified. Currently, I click
the button, scan the document, scan the assignee barcode. Then if I
want to assign another tool, I have to click the button again. Once I
assign the tool, I simply want the pop up to come up that I use to
find the value in A, until I choose to halt by clicking cancel.

Thanks again! You guys rock.
Lee
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top