Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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


--
PGalla06
------------------------------------------------------------------------
PGalla06's Profile: http://www.excelforum.com/member.php...o&userid=24260
View this thread: http://www.excelforum.com/showthread...hreadid=471936

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default WorksheetFunctions

Peter

just use:

x = Mid(MyRange, 2, 5)

Regards

Trevor


"PGalla06" wrote in
message ...

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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
excel.worksheetfunctions Max Excel Worksheet Functions 13 November 26th 05 02:25 AM
can I use WorksheetFunctions ON arrays from VBA?? fern Excel Programming 6 August 8th 05 09:27 PM
No VBA help for Worksheetfunctions available Toppers Excel Worksheet Functions 4 January 23rd 05 04:58 PM
Using WorksheetFunctions in Excel Macros Ken[_18_] Excel Programming 2 March 2nd 04 05:05 PM


All times are GMT +1. The time now is 12:40 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"