Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to parse the comma seperated strings into the excel sheet
Hi
I need to parse the big report which is as string of length 32000 an beyond. Can any body send me a algorithm to parse this to excel sheet. thanks in advance. Regards Venkatesh -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to parse the comma seperated strings into the excel sheet
This is probably more thorough (complicated!) then need be. This
procedure will parse out the contents of the ActiveCell into cells based on the value of MAX_ROWS_IN_OUTPUT :- 0 : values in the rows below the ActiveCell 1 : values in the columns below the ActiveCell nn : values in a block of cells nn high I hope it helps Sean "Just press the off switch, and go to sleep!" '------------------------------------------------ '------------------------------------------------ Sub ParseDown() Const MAX_ROWS_IN_OUTPUT = 0 Dim i As Long, k As String, r As Range, row_offset As Long, column_offset As Long k = ActiveCell.Value ' the thing to parse i = InStr(k, ",") ' find the first comma ' if no commas, just return the original value If (i = 0) Then ActiveCell.Offset(1, 0).Value = k GoTo Finished_ParseDown: End If row_offset = 0 ' put answer in row ? column_offset = 0 ' put answer in column ? Do Until (k = "") ' the resultant values are in a list underneath ' the source value in a list or a block row_offset = row_offset + 1 Select Case MAX_ROWS_IN_OUTPUT Case 0 ' 0 means just a simple list Case Else If row_offset MAX_ROWS_IN_OUTPUT Then row_offset = 1 column_offset = column_offset + 1 End If End Select ' check in case we run out of space On Error GoTo Err_move_to_next_column Set r = ActiveCell.Offset(row_offset, column_offset) On Error GoTo 0 ' check in case our source does not end with a comma If (i = 0) And (k < "") Then r.Value = k k = "" Else r.Value = Left(k, i - 1) ' get the latest value k = Mid(k, i + 1) ' strip the value already gotten End If i = InStr(k, ",") ' find the next comma Loop Finished_ParseDown: Exit Sub Err_move_to_next_column: row_offset = 1 column_offset = column_offset + 1 Resume End Sub '------------------------------------------------ '------------------------------------------------ *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to parse the comma seperated strings into the excel sheet
Have you tried just opening the file in Excel.
-- Regards, tom Ogilvy "kvenku " wrote in message ... Hi I need to parse the big report which is as string of length 32000 and beyond. Can any body send me a algorithm to parse this to excel sheet. thanks in advance. Regards Venkatesh. --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Comma Seperated File | Excel Worksheet Functions | |||
How to split a value seperated by comma? | Excel Discussion (Misc queries) | |||
Importing Comma Seperated Text Please Help ? | Excel Discussion (Misc queries) | |||
Put all cells in one cell seperated by comma | New Users to Excel | |||
pulling out info. seperated by a comma | Excel Programming |