Hi!
On Sheet1 I have some text:
MytextA (cell A2)
MytextB
MytextC
MytextD
MytextE
MytextF
On Sheet2 I have some text:
MytextA Cells(j, 1)
MytextC
MytextE
Onerror works only once, Please help!
On Sheet1 I have some text:
MytextA (cell A2)
MytextB
MytextC
MytextD
MytextE
MytextF
On Sheet2 I have some text:
MytextA Cells(j, 1)
MytextC
MytextE
Onerror works only once, Please help!
Code:
Sub FindText()
Dim a As String, n As String, z As String, j As String
a = "StrgMal"
n = 1
z = a & n
j = 2
Application.ScreenUpdating = True
Worksheets("Sheet1").Activate
Range("A2").Select
Do While ActiveCell.Value <> ""
Sheets("Sheet2").Select
Err.Clear
On Error GoTo JumpToHere
Columns("D").Find(What:=Sheets("Sheet1").Cells(j, 1)).Activate
ActiveCell.Name = z
n = n + 1
z = a & n
JumpToHere:
Err.Clear
j = j + 1
Worksheets("Strategiskt_mål").Activate
ActiveSheet.Cells(j, 1).Selec
Loop
End Sub
Last edited by a moderator: