Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Here is a example that Dave Peterson posted a few months back
It save the files in your temp folder (StartRun %temp% ) With your data in a sheet named "Sheet1" and data in the A column Sub testme() Dim wks As Worksheet Dim newWks As Worksheet Dim iRow As Long Dim FirstRow As Long Dim LastRow As Long Dim myStep As Long Dim iCtr As Long myStep = 12 Set wks = Worksheets("sheet1") Set newWks = Workbooks.Add(1).Worksheets(1) iCtr = 0 With wks FirstRow = 1 LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row For iRow = FirstRow To LastRow Step myStep newWks.Cells.Clear .Rows(iRow).Resize(myStep).Copy _ Destination:=newWks.Range("a1") With newWks Application.DisplayAlerts = False iCtr = iCtr + 1 .Parent.SaveAs Filename:=Environ("temp") & "\Extracted_" _ & Format(iCtr, "000"), _ FileFormat:=xlCSV Application.DisplayAlerts = True End With Next iRow End With newWks.Parent.Close savechanges:=False End Sub -- Regards Ron De Bruin http://www.rondebruin.nl "demianill" wrote in message ... Hi all ! I'm not a programmer, just a simple Excel user. I have the following problem: - I have a Excel file with more than 11,000 lines. - I need to read the first 12 lines (line 1 to line 12) and create a txt file (the filename could be "1.txt", for example) - Then, read the next 12 lines (line 13 to line 24) e create the filename "2.txt" - Again, again, and again, for each next 12 lines, until the end of 11,000 lines, creating the filename "916.txt". Probably, it's very easy for expert users, using a VBA macro. But, for non-programmers, it's a big problem ! Please, help me ! Thanks for all !!! Demian Nill -- demianill ------------------------------------------------------------------------ demianill's Profile: http://www.excelforum.com/member.php...o&userid=25676 View this thread: http://www.excelforum.com/showthread...hreadid=553386 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I create and save .odc and .oqy files in excel? | Excel Discussion (Misc queries) | |||
Create new excel files, Save backup of excel file | Excel Programming | |||
create a inventory of files on computer in excel | Excel Discussion (Misc queries) | |||
How to I create a pdf file from Word or Excel files | Excel Discussion (Misc queries) | |||
Why does Excel in XP create new files? | Excel Discussion (Misc queries) |