Replace Word in Cell with Value from Another Cell

tomgrandy

New Member
Joined
May 10, 2024
Messages
41
Office Version
  1. 365
Platform
  1. MacOS
I'm new to VBA and am trying to replace a word found in L3 (AUCTION_DATE) with the value from H3 (Date Lot Sold - there are 70,000 entries and not all are 02-04-23) and then have this repeated throughout the worksheet for all items in Row L that have the words "AUCTION_DATE".

Basically replace the words "AUCTION_DATE" in each row of Column L with the value in the corresponding cell value in Column H (for each row).

Spent the best part of two hours trying to search for a site that had the solution, but none of the Find and Replace VBA codes would pull from another cell.

Any help greatly appreciated!!

Screenshot 2024-05-10 at 12.13.48 PM.png
 
If an Array would speed up the process (takes about 20 seconds for each VBA to run) then that would be a huge timesaver!:

Another option:
VBA Code:
Sub KeywordFlakedArtifacts_2()
Dim i As Long
Dim va, vb, x
Dim t As Double
t = Timer
      va = Range("c2:c70000")
      vb = Range("J2:J70000")
        For Each x In Array("ABBEY", "ACATITA", "ADDISON MICRO-DRILL")
            x = UCase(x)
            For i = 1 To UBound(va, 1)
                If InStr(1, UCase(va(i, 1)), x, vbBinaryCompare) > 0 Then vb(i, 1) = "POINT"
            Next
        Next
     Range("J2").Resize(UBound(vb, 1), 1) = vb
Debug.Print "Completion time:  " & Format(Timer - t, "0.00") & " seconds"
End Sub
 
Upvote 0

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Forum statistics

Threads
1,223,099
Messages
6,170,107
Members
452,302
Latest member
TaMere

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