LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Junior Member
 
Posts: 9
Default Marco is not working

I have converted the below macro from function in to sub. In a Function, it returns the correct values and texts in the respected Columns,but not if it is a Sub Procedure. I am sure something is missing from the sub macro, but I am unable to figure it out.

For e.g, the cell is in Column A is "abcdef123xyz" , the value returns in Column B is 1.23123E+34, instead of returning 123. The same for text1.23123E+34

Please help.



Sub numer()
Dim c As Range, t As String, K As Long, tmpText As String, n As Long
t = ""
For Each c In Range("A1:A12").Cells
tmpText = c.Value
For n = 1 To Len(tmpText)
If IsNumeric(Mid(tmpText, n, 1)) Then
t = t & Mid(tmpText, n, 1)
End If
Next n
For K = 1 To 12
Range("b" & K) = Val(t)
If Not IsNumeric(Mid(tmpText, n, 1)) Then
t = t & Mid(tmpText, n, 1)
End If
Range("B" & K).Offset(0, 1) = t
Next K
Next c

End Sub
 
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
Marco JBoyer Excel Programming 3 July 8th 08 10:49 PM
Help with marco Gary Keramidas Excel Programming 1 December 2nd 06 05:17 AM
Marco from XP not working in 97 [email protected] Excel Programming 1 June 30th 05 08:48 PM
Marco Loi New Users to Excel 4 December 7th 04 08:52 PM
marco David Kuehl Excel Programming 4 September 18th 03 11:37 PM


All times are GMT +1. The time now is 05:05 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"