Hi all,
A simple VBA question.
I am using (or trying to) an excel macro to read temperatures from a file and output them in a new formatted file. The macro is;
I want;Sub test1() ' ' Format Temperature File ' FileName1 = "D:\data\temps.inp" Open FileName1 For Input As #1 Open "D:\data\temps.out" For Output As #3 ' Read File reformat and output Do While Not EOF(1) Line Input #1, Dummy1 Point1 = Left(Dummy1, 8) Temp1 = Mid(Dummy1, 10, 21) Print #3, Val(Temp1) Print #3, Point1 Loop Close #1 Close #3 End Sub
^^^970.031
3000001
^^^934.616
3000002
^^^882.253
3000003
^^^560.491
3000004
^^^575.562
3000005
I get;
970.031
3000001
934.616
3000002
882.253
3000003
560.491
3000004
575.562
3000005
How do I modify the macro to give me what I require.
ie 3 spaces, temperature
0 spaces, point
Thanks for reading. All help gratefully received.
M
Last edited by royUK; 05-19-2009 at 05:00 AM.
Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
Hope that helps.
RoyUK
--------
If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need
For Excel Tips & Solutions, free examples and tutorials why not check out my downloads
New members please read & follow the Forum Rules
Remember to mark your questions Solved and rate the answer(s)
oops!! Sorry about that, Roy. I'll read the forum rules when I have time. Thanks for the advise.
M
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks