Login | |
|
 |
.CSV to text - 7/21/2008 5:33:48 AM
|
|
 |
|
| |
foster.craig.d
Posts: 2
Score: 0
Joined: 7/18/2008
Status: offline
|
Hello, I've been beating my head against a wall for quite sometime now. I need a script that will read in a .CSV file, and find where the first column value is zero. Once that point is established a text file that contains the next 500 rows of the first column and the next column needs to be written. This will be repeated, for the remaining columns. That is column one and whichever column is the next, with a seperate file for each pair. Problem is finding where this value of zero occurs, and identifying the cell location. I've tried many differnt snippets of code found here an there. At this point I'm thoroughly confused. I tried to do this initially with AWK, it seems AWK doesn't behave as expected through the command prompt. So now I've resorted to VBScript, however this is relatively new and of course it doesn't seem to behave as expected either. I did try the macro recorder method as suggested on this forum. The latest bit of code snippet I've tried is coming from the Sam's 21 day book, and combined with a snippet out of the Visual Basic reference. Thank you in advance for any help that may be forthcoming. The snippet that I am currently working with is as follows: Dim appXL Set appXL = WScript.CreateObject("Excel.Application") 'Set appWS = WScript.CreateObject("Excel.Worksheet") 'Set appRG = WScript.CreateObject("Excel.Range") appXL.Visible = True appXL.Workbooks.Open("C:\P1_2_4ms.CSV") MsgBox(appXL.Windows(1).Caption) MsgBox(appXL.Cells(1, 3).Value) With ActiveSheet(1)appXL.Cells("a1:a500") Set c = appXL.Find(0, lookin:=xlValues) If Not c Is Nothing Then firstAddress = c.Address Do c.Value = 5 Set c = .FindNext(c) Loop While Not c Is Nothing And c.Address <> firstAddress End If End With If appXL.ActiveWorkbook.Saved = False Then MsgBox("Save me") End If
|
|
| |
|
|
|
|
|