Need Help:- VBA Code to find specific word from range and change next range value

UPENDER Mahato

New Member
Joined
Jun 1, 2015
Messages
3
Hi All,

I am looking for a code which can help me to find a word based on provided range input in another range and then change the value of another equivalent range. I have write below query but it's not working fine. Please help to correct the code.
For Ex. Reference Range value = Adobe and Fiand Range Values are redbooks.pdf - Adobe Reader, 02-COBOL-Dataname-Editing Charaters.pdf - Adobe Reader, TSO_and_ISPF.pdf - Adobe Reader, Adobe Reader, BW-Handout-V2 0 0.pdf - Adobe Reader, etc.
I am looking a code which serach Adobe in all the range text and change the next column value as 1.

Please help to correct code.

Sub Second_Allocation3()
Dim msht As Worksheet
Dim sht As Worksheet
Dim myarr As Variant
Dim rng As Range
Dim srng As String
Set msht = Worksheets("Data")
Set sht = Worksheets("Reference Data")
lr = sht.Range("D125000").End(xlUp).Row
lr1 = msht.Range("A125000").End(xlUp).Row
msht.AutoFilterMode = False
' msht.Range("K:K").Value = msht.Range("A:A").Value
For i = 2 To lr
srng = sht.Range("D" & i).Value
' msht.Range("A1:I" & lr).AutoFilter Field:=1, Criteria1:=srng
For J = 2 To lr1
If msht.Range("A" & J).Find(What:=srng, LookIn:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False) Then
msht.Range("I" & J).Value = "1"
End If
Next J
' msht.AutoFilterMode = False

Next i
End Sub
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

Forum statistics

Threads
1,215,528
Messages
6,125,338
Members
449,218
Latest member
Excel Master

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