Search : in
By :

Find copy and create new excel files w macro

Last answer on Mar 17, 2009 9:22:07 pm GMT hero85, on Mar 13, 2009 1:33:46 pm GMT 
 Report this message to moderators

Hello,
I would like to create a macro to save time. I receive data which I then have to process in excel.
Right now, I need help with copying and paste the data into new excel files automatically.
The data I receive is always like this:
--Start test--
45
34
23
454
232
--End Test--
--Start test--
99
33
22
--End Test--

So in this example, I received a file which had two tests in it that means two different files should be created. So I need to copy everything in between start test and end test. And then paste it into a new excel file.
Any links or any type of help will be appreciated.

Configuration: Windows XP
Internet Explorer 6.0

Best answers for « Find copy and create new excel files w macro » in :
Creating an empty file Show Creating an empty file To create an empty file, type the following command: > file You can also use the touch command: touch file
IPhoto – Creating or Selecting a new Photo Library ShowiPhoto – Creating or Selecting a new Photo Library You need a second library, or simply want to store their photos in other Pictures on the disk system? This requires start iPhoto while holding down Alt. A window will then propose a...
How to convert Excel into PDF? ShowHow to convert Excel into PDF? Here is a small tips about how to convert your excel files into PDF for your presentation. Step 1 PDF995 is software that gets installed on your computer which enables you to print any sources of document to...
Creating an Autorun.inf file ShowCreating an Autorun file Allowing autorun Creating an Autorun.inf file Variations Customizing the icon Customizing the icon text Customizing the icon menu Allowing autorun Windows provide users with simple utility that runs...
The NTFS file system ShowThe NTFS file system The NTFS file system (New Technology File System) is based on a structure called the "master file table" or MFT, which is able to hold detailed information on files. This system allows the use of long names, but, unlike the...
Spreadsheets - The Excel Interface ShowExcel Introduction Microsoft Excel is the spreadsheet in the Microsoft Office office suite. To start it, simply click on the appropriate icon in the Start menu (in Windows) or click on an Excel file (that has an .xls file extension). A Excel...

1

WutUp WutUp, on Mar 15, 2009 2:20:15 am GMT
  • +1

This code assumes that the data is in column A and there are no empty rows from the start to the end of the data. Also, the data is copied from Sheet2 to Sheet1 and the rows to copy start in row one and will be copied to row one.


Sub CopyToNewSheet()

Set o = Sheets("Sheet1") 'Where the data is copied to. You can rename it to your sheet name.
Set t = Sheets("Sheet2") 'Where the data resides. You can rename it to your sheet name.
Dim CpyData
Dim d
CpyData = 0
d = 1


Do While Not IsEmpty(t.Range("A" & d))

If IsNumeric(t.Range("A" & d)) Then
CpyData = CpyData + 1

o.Range("A" & CpyData) = t.Range("A" & d)

End If

d = d + 1

Loop

End Sub

Reply to WutUp WutUp

2

 hero85, on Mar 17, 2009 9:22:07 pm GMT
  • +1

Ok, I will try this code soon. I hope it works. Also is there not a way to copy from one file to another? I don't want to transfer to a sheet but to a file!

Reply to hero85