I have a device which outputs readings of different values to a text file - abc.txt. Each reading is bracketted on a separate line preceded by a descriptive code (in the example below - 0.4 = act power, 0.6 = max power and 0.8 = energy). Each group of measurements has a first line with the time e.g. 2 groups of data:
16:16:00
0.4(0.087)
0.6(0.09)
0.8(000.051)
16:17:00
0.4(0.088)
0.6(0.09)
0.8(000.053)
I would like to to turn this into an Excel spreadsheet with headings like Time¦Act Power¦Energy¦Max Power¦Voltage¦Current
with correspoding values in the rows below. Yes, columns like Voltage must be present even if data is not always present and readings might not always be in the same sequence within groups, but the start of a group can always be identified by the time tag (or presence of ":" in position 3). So as I understand it - I need to have a fixed header, then examine each line's code. If it is a "0.8", put the value in the Enery column etc. but if it is a time tag- go to the next row and import the next group. I'd like to put the code in a macro. How do I do all this in VBA? I'd really be grateful for some example code.
This is my first post.Is this scenario too complex? Should I break it up into separate questions?
Thank you
16:16:00
0.4(0.087)
0.6(0.09)
0.8(000.051)
16:17:00
0.4(0.088)
0.6(0.09)
0.8(000.053)
I would like to to turn this into an Excel spreadsheet with headings like Time¦Act Power¦Energy¦Max Power¦Voltage¦Current
with correspoding values in the rows below. Yes, columns like Voltage must be present even if data is not always present and readings might not always be in the same sequence within groups, but the start of a group can always be identified by the time tag (or presence of ":" in position 3). So as I understand it - I need to have a fixed header, then examine each line's code. If it is a "0.8", put the value in the Enery column etc. but if it is a time tag- go to the next row and import the next group. I'd like to put the code in a macro. How do I do all this in VBA? I'd really be grateful for some example code.
This is my first post.Is this scenario too complex? Should I break it up into separate questions?
Thank you