suppose it finds some specific text like “sa” in A2,A4,A5,A6
i need to copy “sohail” in B2,B4,B5,B6 respectively,
like this…
ImageName PhotographerName
pirf_20120523_sa0001.jpg sohail
pirf_20120523_ml0001.jpg manav
pirf_20120523_sa0001.jpg sohail
pirf_20120523_sa0001.jpg sohail
pirf_20120523_sa0001.jpg sohail
pirf_20120529_sh0005.jpg shirazi
pirf_20120523_ml0001.jpg manav
pirf_20120529_sh0005.jpg shirazi
i tried to retrieve the addrres where it finds text…
Sub FindinTextInEachCell()
Dim rngX As Range
Set rngX = Worksheets("Sheet1").Range("A1:A10").Find("sa", lookat:=xlPart)
If Not rngX Is Nothing Then
MsgBox "Found at " & rngX.Address
End If
End Sub
You’re not using
Findmethod properly, it’ll only return the firstRangeit finds, you’ll have to usefindnext()method for subsequent ranges, but since subsequent ranges will duplicate, you’ll have to compare it with the first address found.