Search for text, then insert value in previous cell

solidENM

Board Regular
Joined
Feb 23, 2017
Messages
93
Hello,
I need some vba that will search sheet1 for specific text in col C, then insert value of 1 into that rows B column.

I tried the manual recording, but that would not step over to previous column. It defines the exact cell i clicked on.


example: search col C (header is description) for word "wood," then insert value 1 into col b (header is qty). this must continue on to find all matches like this. Most files will have 5-10 lines with wood, but it varies.
 
Glad to help & thanks for the feedback
 
Upvote 0

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
would you know how I could use this to change the value in cell f, same row that it changed the qty to 1? I would like all the ones that are included in this search to create a part name.

The name will be the contents of cell A1 + part number in col D for that row. I currently have the filename in cell a1, and various other info on the first column. I use these to make the header and footer, then delete the row when its done. I was hoping to use the job name in A1 t

ex:
col F= "A17423 3/16 clear"
col F= "A17423 1/4 clear"
col F= "A17423 2x2 Profile"
 
Upvote 0
Something like this
Code:
Sub FndValu()
'solidENM
    Dim lrow As Long
    Dim Cnt As Long
    Dim StrArray As Variant
    Dim Arr As Variant
    
    lrow = Cells.Find("*", After:=Range("A1"), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    StrArray = Array("3/16", "1/4")
    For Cnt = 2 To lrow
        For Each Arr In StrArray
            If Cells(Cnt, 4) Like "*" & Arr & "*" Then
                Cells(Cnt, 2) = Cells(Cnt, 1)
                Cells(Cnt, 6) = Cells(1, 1).Value & " " & Cells(Cnt, 4).Value
            End If
        Next Arr
    Next Cnt

End Sub
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,206
Members
453,022
Latest member
RobertV1609

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