Below is some simple code I use to find and replace text. It works great when the text has 8 or less lines. When it's more than 8 lines it gives me the wonderful Mismatch Error 13. Basic example below -
replacetext = ("")
k as string
k = sheets("exampleabove").cells(1, 1)
Set Sheet = Sheets("examplesheet")
Sheet.Cells.Replace what:=k, Replacement:=replacetext, _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, _
SearchFormat:=False, ReplaceFormat:=False
This works perfectly if the cell has 8 or less lines, but after that i get the error.
Should i use some other variable than string?
Line 1 Line 2 Line Randomn Another Line So on and so forth |
replacetext = ("")
k as string
k = sheets("exampleabove").cells(1, 1)
Set Sheet = Sheets("examplesheet")
Sheet.Cells.Replace what:=k, Replacement:=replacetext, _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, _
SearchFormat:=False, ReplaceFormat:=False
This works perfectly if the cell has 8 or less lines, but after that i get the error.
Should i use some other variable than string?