Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Comma Seperated File Ricardo0303 Excel Worksheet Functions 2 April 10th 07 04:45 PM
How to split a value seperated by comma? Ticktockman Excel Discussion (Misc queries) 2 March 23rd 06 04:20 PM
Importing Comma Seperated Text Please Help ? Byron Excel Discussion (Misc queries) 1 August 16th 05 10:36 AM
Put all cells in one cell seperated by comma kokopoko New Users to Excel 6 August 6th 05 03:03 AM
pulling out info. seperated by a comma scrabtree[_2_] Excel Programming 1 July 27th 04 04:12 PM


All times are GMT +1. The time now is 12:16 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"