greetings,
I am reading from a text file large amount of data and putting this into a array. I'd like to be able to 'paste' that array into a specific column within Excel. Is this possible?
Right now I have a 'for' loop that that increments the array and copies the content into a cell which is not very efficient at times. I know this because I have a StatusBar that displays the row it's on, and at times, the display increments slower, especially when I have several Excel spreadsheets opened.
I'm on office 2007.
many thanks.
cg
Last edited by lacour; 01-11-2012 at 08:33 PM.
lacour
Is it a txt file?
regards pike
If the solution helped please donate here to the RSPCA
Sites worth visiting;
J&R Solutions - royUK
AJP Excel Information - Andy Pope
Spreadsheet Toolbox
VBA for smarties - snb
I'm reading from a text file using VBA, the content of that text file is held in a vairable called sText
Once the content of the file is loaded into sText, I copy sText into an Array as suchOpen sFile For Input As #iFileNum sText = Input$(LOF(1), 1) Close iFileNum
sArray = Split(sText, vbNewLine)
then I parse scan the array row by row and write the content to each cell. This is the part I'd like to change. I would like to get away from parsing this through the loop and would prefer instead to write one statement that copies either sText or sArray() into the respective rows.
Do While j <= UBound(sArray) rngRef.Cells(j, 1) = sArray(j) j = j + 1 Loop
Last edited by pike; 01-13-2012 at 03:46 PM. Reason: add code tags for newbie
Could you not just import the file or open it directly?
Good luck.
can you attach the text file?
Many different ways and its easier if i have the file to play with
regards pike
If the solution helped please donate here to the RSPCA
Sites worth visiting;
J&R Solutions - royUK
AJP Excel Information - Andy Pope
Spreadsheet Toolbox
VBA for smarties - snb
anyway with out look at the file
Cells(1, 1).Resize(UBound(sarray), 1).Value = Application.Transpose(sarray)
regards pike
If the solution helped please donate here to the RSPCA
Sites worth visiting;
J&R Solutions - royUK
AJP Excel Information - Andy Pope
Spreadsheet Toolbox
VBA for smarties - snb
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks