Search code examples
excelvba

Finding a value and updating status in same row


I have a spreadsheet that has a "Master entries" tab and a "Billing actions" tab. On the Billing actions tab I have a cell (A2) that is used as a reference for a bunch of other lookups on the same tab.

"A2.Billing actions" is my lookup value "Column D.Master entries" is my lookup range "Column I.Master entries" is the range that I want to update based upon the row The value to update should be set to Today/Now (fine with dd/mm/yyyy no need for any more specifics)

I will be wanting to replicate this with switching up Column I to Column K but I should be able to do that fairly easily.

I've searched around on a couple of forums but can't seem to find anything that works.

Appreciate any help that can be provided.

So far i've worked out how to get the row using a text box but would rather it come from the value in "A2.Billing actions"

Dim found As Range
Set found = Sheets("Master entries").Columns("D").Find(what:=InputBox("Enter search term"), LookIn:=xlValues, lookat:=xlWhole)

If found Is Nothing Then
    MsgBox "Not found"
Else
    MsgBox "Found on row " & found.Row
End If

Solution

  • Try this which use cell A2 as the value to find, and set the corresponding cell in column I to the present date.

    Dim found As Range
    Set found = Sheets("Master entries").Columns("D").Find(what:=Worksheets("Billing Actions").Range("A2"), LookIn:=xlValues, lookat:=xlWhole)
    
    If found Is Nothing Then
        MsgBox "Not found"
    Else
        MsgBox "Found on row " & found.Row
        Worksheets("Master entries").Cells(found.Row, "I") = Format(Now(), "dd\/mm\/yyyy")
    End If