LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Unable to record complicated formula in macro


Hello Viduo,

You can use a User Defined Function (UDF) in place of the Worksheet
functions. Add a VBA module to your Workbook's Project and copy this
code into it.

Example of Uing the UDF:
A1 = "abc123efg"
B1 = "=GetNumbers(A1)"
B1 will contain 123

Public Function GetNumbers(ByRef Cell As Range)

Application.Volatile

Dim I As Long
Dim N As Long
Dim X As String

For I = 1 To Len(Cell.Text)
N = Asc(Mid(Cell.Text, I, 1))
If N 47 And N < 58 Then X = X & Chr$(N)
Next I

GetNumbers = X

End Function

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=502634

 
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
UNABLE TO RECORD A MACRO I.C.E. Excel Worksheet Functions 1 September 13th 06 01:24 PM
Unable to record Macro Can not Record Macro Excel Discussion (Misc queries) 1 July 29th 06 01:11 AM
Unable to Record Macro murray Excel Discussion (Misc queries) 1 September 12th 05 10:22 PM
Unable to record macro Pat Excel Discussion (Misc queries) 4 May 20th 05 01:43 AM
Unable to record (macro) JimP Excel Programming 3 July 2nd 04 05:51 PM


All times are GMT +1. The time now is 03:11 AM.

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

About Us

"It's about Microsoft Excel"