+ Reply to Thread
Results 1 to 2 of 2

WorksheetFunctions

  1. #1
    Registered User
    Join Date
    06-13-2005
    Posts
    21

    WorksheetFunctions

    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

  2. #2
    Trevor Shuttleworth
    Guest

    Re: WorksheetFunctions

    Peter

    just use:

    x = Mid(MyRange, 2, 5)

    Regards

    Trevor


    "PGalla06" <[email protected]> wrote in
    message news:[email protected]...
    >
    > 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
    >
    >
    > --
    > PGalla06
    > ------------------------------------------------------------------------
    > PGalla06's Profile:
    > http://www.excelforum.com/member.php...o&userid=24260
    > View this thread: http://www.excelforum.com/showthread...hreadid=471936
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1