I'm trying to use the WorksheetFunction.Mid to cut out a piece of text from a string and place it in an array. However, I can't get the Mid function to work. I keep getting a a 438 run time error message. Below is the code that I'm using.
Sub MySub()
Dim x As Variant
Dim MyRange As Range
Set MyRange = Worksheets("Sheet1").Range("A1")
x = Application.WorksheetFunction.Mid(MyRange, 2, 5)
MsgBox x
End Sub
Any help would be greatly appreciated.
Thank,
Peter
Bookmarks