Search cell to paste value

andrebrigoni

New Member
Joined
Oct 9, 2014
Messages
1
Hi guys, good morning!
This is my first thread here at MrExcel.com.
I've been searching the web for help on VBA for the last weeks and learned a lot already!
However, when it comes to using VBA, I can say that I'm still "crawling"!
What I would like to ask you guys is what kind of function I could use to search for the correct cell to paste value from another worksheet.
Trying to make things clearer:
I use excel to register different information on about 5000 people, and I've already created userforms for that.
Some of that information is simply registered on a "next available row basis", while other needs to "match" ID number on a row and type of information on a column so that I can find the correct cell to paste info on.
I've found hundreds of threads using Vlookup or IndexMatch to find cell to copy value from, but never to paste value on.
I'd very deeply appreciate any help you guys could provide me with!
Thank you! :)
 

Warship

Well-known Member
Joined
Jul 17, 2007
Messages
1,051
This will find the first instance of what you look for and return the Row it was found on.
I typically know the Column I need to update so once I have the Row I know the cell to place the data.

Code:
Sub SimpleFind()
    Dim fnd As Range
    Dim rngSearchRange As Range
    Dim intRowFoundOn As Integer
    Dim strWhatToFind As String
    
    Set rngSearchRange = Sheets("Sheet1").Range("A:A")
    strWhatToFind = Application.InputBox("Enter String to find")
    
    Set fnd = rngSearchRange.Find(strWhatToFind, , , xlWhole)
    If Not fnd Is Nothing Then
        intRowFoundOn = fnd.Row
        MsgBox strWhatToFind & " was found on Row " & intRowFoundOn & "."
    Else
        MsgBox strWhatToFind & " was not found."
    End If
End Sub
 

Forum statistics

Threads
1,085,495
Messages
5,384,007
Members
401,871
Latest member
allemandi

Some videos you may like

This Week's Hot Topics

Top