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,082,178
Messages
5,363,598
Members
400,754
Latest member
Russboy69

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top