WorksheetFunctions

  • Thread starter Thread starter PGalla06
  • Start date Start date
P

PGalla06

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top