Search : in
By :

Help me write a Macro for Excel PLEASE

Last answer on Jun 5, 2009 12:36:14 pm BST MikeA, on May 21, 2009 7:49:58 pm BST 
 Report this message to moderators

Hello, I have an excel data file with a X axis of mass values 50-250 and a Y axis of time from 1-6000 seconds. Filling out the grid are intensity values for a given mass at a particular time. I need to extract every seventh data point because the ones in between are useless to me. Is there a way to extract every 7th data point and put it into a different worksheet using a macro. PLEASE HELP ME!

Configuration: Windows XP Internet Explorer 7.0

Best answers for « Help me write a Macro for Excel PLEASE » in :
Connect a database (MDB) to excel Show[VBA] Connecting a database (MDB) to excel Below is a tips of how to connect an Access database (MDB) in an application excel Add reference Microsoft DAO object librairy X.X In a general module (eg Module1) paste the code below...
Writing in batch in text file ShowWriting in batch in text file To write in a file text, you just have to use a redirect: echo text > output_file.txt To write in an existing file: echo " Write at the end of the file ">> output_file.txt
Inserting an animated gif in Excel ShowInserting an animated gif in Excel To insert an animated gif image in an Excel spreadsheet, you must insert the image into a control. To insert the control, go to the View menu/Toolbars/Control Toolbox Activate the first button Design...

1

manish, on Jun 4, 2009 3:54:45 pm BST
  • +1

How to merge rows ,columns thru macro in excel?

Reply to manish

2

 alexhett, on Jun 5, 2009 12:36:14 pm BST

You don't need a macro for this. One might be helpful, but I think the time & effort you would spend creating/finding etc. the macro would be more than doing it semi-manually.

[note: it's unclear if your "seconds" data is sequential (i.e. 1,2,3,...,6000), or randomly distributed between 1 and 6,000 (i.e. 47, 359, 2, 1000,...etc.). If it is sequential your problem is very easy. But assuming it's not... do the following...

Assuming your data are in two adjacent columns... (if they're not you could transpose/move them)...

Create an index column, 1,2,3,...,etc. Put this adjacent to your data. Make sure you put a header/label above the column of data as "index" or something.

Then, elsewhere (on the same sheet) create a criteria column, 7,14,21,28,...,etc. This column must have the exact same label as the "index" column.

Then use the Data Menu>Filter>Advanced Filter

Select the index column for your List Range, the Criteria column for your criteria, Make sure you include the column headers (i.e. the text that says "index" or whatever) for both columns, then filter the list in place.

This will give filter out the six rows between every seventh row. If your data and you index column are lined up next to each other, your data will receive the same filtering. From there, just select your data columns, and copy them into a new sheet. Then your done! Good Luck!

Reply to alexhett