ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel VBA Macro - parse data (https://www.excelbanter.com/excel-programming/303608-excel-vba-macro-parse-data.html)

kb42

Excel VBA Macro - parse data
 
Hello
I need help on very simple Excel question.
I have excel file exported from quickbooks which has buying cos
column: Here is some sample data

$0.04
$1.50
$1.135
$0.445*04
$0.01*EX
$0.02(some text)
$0.063 ES

I want to get only cost ( means I want to delete the strings after
"*", "(" , or space ).

Thank you in advance for your help!!!

Jaso

--
Message posted from http://www.ExcelForum.com


MSP77079[_43_]

Excel VBA Macro - parse data
 
I pasted the examples you gave into cells C5:C11

Sub test()

For i = 5 To 11
myText = Cells(i, "C")
myLen = Len(myText)
For n = 1 To myLen
If IsNumeric(Left(myText, n)) Then thisNum = Left(myText
n)
Next n
Cells(i, "F") = Format(thisNum, "$ #.00")
Next i


End Su

--
Message posted from http://www.ExcelForum.com


kb42[_2_]

Excel VBA Macro - parse data
 
Thank you very much, it worked perfectly!!

Jaso

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 09:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com