Wow!!!!!!!! Impressive!!! It worked and it was really quick!!!

Thank you very very much!!

Cesar

Em quinta-feira, 12 de setembro de 2013 07h41min51s UTC-3, De Premor 
escreveu:
>
>  Please try this, i've got almost 7 second with attached code 
>
>
>
>
> On 12-09-2013 0:45, CesarSan wrote:
>  
> Paul, 
>
>  
>  Thanks for the answer! I usually breaks into ~250 sheets and a total of 
> ~2500 columns.
>
>  I can send you the file, but how can I do that without having to attach 
> it in the forum?
>
>  
>  Thanks,
> Cesar
>
> Em quarta-feira, 11 de setembro de 2013 13h29min33s UTC-3, Paul Schreiner 
> escreveu: 
>>
>>  Could you send me (directly) a sample data file?
>> even just a couple thousand lines would be sufficient.
>> (otherwise, I have to spend time creating sample data!)
>>  
>> I routinely read in comma delimited files.
>> (The largest is 127,000 lines)
>>  
>> I think there are several things I could do with your macro to speed it 
>> up.
>>  
>> BTW: How many sheets does it typically break down into?
>> how many parameters? (columns)?
>>  
>> *Paul*
>> -----------------------------------------
>> *“Do all the good you can,
>> By all the means you can,
>> In all the ways you can,
>> In all the places you can,
>> At all the times you can,
>> To all the people you can,
>> As long as ever you can.” - John Wesley
>> *-----------------------------------------
>>
>>   *From:* CesarSan <cesarhenriq...@gmail.com>
>> *To:* excel-...@googlegroups.com 
>> *Sent:* Wednesday, September 11, 2013 11:42 AM
>> *Subject:* $$Excel-Macros$$ While Not EOF too Slow
>>  
>>  I have been researching for a quicker way to do the following task, but 
>> I couldn´t... 
>>
>>  Can you please help me with that? It is basically a parser that convert 
>> text files into sheets, but the problem is that the text file has about 
>> 100000 lines and this code is taking more then half hour to run!
>>
>>  For each new line of the text file, first I check if the sheet already 
>> exists and then check if the column title already exists... if so, it fills 
>> the data in the corresponding field, if not it creates the sheet and the 
>> column.
>>
>>  I know that this code is not optimized at all, but I am not a 
>> programmer so that is the way I could make this job.
>>
>>   
>>
>>  
>>  
>>  
>>                  Open sFileName For Input As #1
>>                 While Not EOF(1)
>>                     
>>                     Line Input #1, sLin
>>             
>>                     If Left(sLin, 3) = "ADD" Or Left(sLin, 3) = "SET" Or 
>> Left(sLin, 3) = "MOD" Then
>>                         sLinSplitted = Split(sLin, ",")
>>                         NumberOfParameters = UBound(sLinSplitted)
>>                             
>>                         For p = 0 To NumberOfParameters
>>                         
>>                         Select Case p
>>                         
>>                         Case 0
>>                             Aux1 = Split(sLinSplitted(p), ":")
>>                             AuxTabl = Split(Aux1(0), " ")
>>                             Tabl = AuxTabl(1)
>>                             Aux2 = Split(Aux1(1), "=")
>>                             Parm = Aux2(0)
>>                             Parmval = Aux2(1)
>>                             If Tabl <> Tablpre Then
>>                                 DoNotCreate = 0
>>                                     For Each sh In ThisWorkbook.Worksheets
>>                                         If sh.Name = Tabl Then
>>                                             DoNotCreate = 1
>>                                             GoTo Continue:
>>                                         End If
>>                                     Next
>>                                 If DoNotCreate <> 1 Then
>>                                     
>> ThisWorkbook.Worksheets.Add(After:=ThisWorkbook.Worksheets(ThisWorkbook.Worksheets.Count)).Name
>>  
>> = Tabl
>>                                 End If
>>                                 Tablpre = Tabl
>>                             End If
>> Continue:
>>                             
>>                             Linh = 
>> ThisWorkbook.Sheets(Tabl).UsedRange.Rows.Count + 1
>>                             ThisWorkbook.Sheets(Tabl).Cells(1, 1) = "NE"
>>             
>>                         Case Is > 0
>>                             Aux2 = Split(sLinSplitted(p), "=")
>>                             Parm = Aux2(0)
>>                             Parmval = Aux2(1)
>>                         
>>                         End Select
>>                             Parm = Replace(Parm, " ", "")
>>                             Parmval = Replace(Parmval, ";", "")
>>                             Set Strg = 
>> ThisWorkbook.Sheets(Tabl).Range("1:3").Find(Parm, LookAt:=xlWhole)
>>                             If Strg Is Nothing Then
>>                                     With 
>> ThisWorkbook.Sheets(Tabl).Rows("1:1")
>>                                       Set CT = .Find(What:="")
>>                                     End With
>>                                 colun = CT.Column
>>                             Else
>>                                 colun = Strg.Column
>>                             End If
>>                             
>>                             ThisWorkbook.Sheets(Tabl).Cells(1, colun) = 
>> Parm
>>                             ThisWorkbook.Sheets(Tabl).Cells(Linh, colun) 
>> = Parmval
>>             
>>                         Next
>>                         
>>                         ThisWorkbook.Sheets(Tabl).Cells(Linh, 1) = NEName
>>                         If ThisWorkbook.Sheets(Tabl).Cells(2, 1) = "" Then
>>                             Linh = 2
>>                         Else
>>                          Temp = 
>> ThisWorkbook.Sheets(Tabl).UsedRange.Rows.Count
>>                          Linh = Temp + 1
>>                         End If
>>                     End If
>>                  Wend
>>             Close
>>
>>  
>>  
>>  An example from the input text file is:
>>
>>  SET ALMBLKPARA:AID=20031, BLKPRD=0, CNTRISTHRD=0, CNTSTLTHRD=0, 
>> TMRISTHRD=0, TMSTLTHRD=0;
>>
>>  Where ALMBLKPARA must be the name of the sheet, AID, BLKPRD, 
>> CNTRISTHRD, CNTSTLTHRD, TMRISTHRD and TMSTLTHRD the column titles with the 
>> corresponding value after each "=".
>>
>>  
>>  I really appreciate your help.
>>
>>  Thanks,
>> Cesar
>>  -- 
>> Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
>> =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
>> https://www.facebook.com/discussexcel
>>  
>> FORUM RULES
>>  
>> 1) Use concise, accurate thread titles. Poor thread titles, like Please 
>> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice 
>> will not get quick attention or may not be answered.
>> 2) Don't post a question in the thread of another member.
>> 3) Don't post questions regarding breaking or bypassing any security 
>> measure.
>> 4) Acknowledge the responses you receive, good or bad.
>> 5) Jobs posting is not allowed.
>> 6) Sharing copyrighted material and their links is not allowed.
>>  
>> NOTE : Don't ever post confidential data in a workbook. Forum owners and 
>> members are not responsible for any loss.
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "MS EXCEL AND VBA MACROS" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to excel-macros...@googlegroups.com.
>> To post to this group, send email to excel-...@googlegroups.com.
>> Visit this group at http://groups.google.com/group/excel-macros.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>
>>      -- 
> Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
> =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
> https://www.facebook.com/discussexcel
>  
> FORUM RULES
>  
> 1) Use concise, accurate thread titles. Poor thread titles, like Please 
> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice 
> will not get quick attention or may not be answered.
> 2) Don't post a question in the thread of another member.
> 3) Don't post questions regarding breaking or bypassing any security 
> measure.
> 4) Acknowledge the responses you receive, good or bad.
> 5) Jobs posting is not allowed.
> 6) Sharing copyrighted material and their links is not allowed.
>  
> NOTE : Don't ever post confidential data in a workbook. Forum owners and 
> members are not responsible for any loss.
> --- 
> You received this message because you are subscribed to the Google Groups 
> "MS EXCEL AND VBA MACROS" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to excel-macros...@googlegroups.com <javascript:>.
> To post to this group, send email to excel-...@googlegroups.com<javascript:>
> .
> Visit this group at http://groups.google.com/group/excel-macros.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
> 

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to