Could you please help me on below error in vba. Formula works but there are error. My scenario is need to extract in between number (between two "-")
Ite1-223466678-ghtrdhjuyr321
Ite-654354477-hjuyt-
Dftehh-767678765-4yutiuy
Extract only this 9 digit in between "-" and need to apply till last row of my excel through VBA
Formula:
= Value(mid(A1,search("-",A1)+1, search ("-",A1, search ("-", A1)+1-search("-", A1)-1))
VBA:
Sub Data2
Dim lastrow as long
Lastrow=Range("A"&rows.count).end(xlup).row
Range("F2:F" & lastrow).formula = " =
Value(mid(A1,search("-",A1)+1, search
("-",A1, search ("-", A1)+1-
search("-. ", A1)-1)"
End sub
ERROR
#VALUE ERROR need to fix am not sure how to do if search fails in formula
RUNTIME ERROR 13 data mismatch