Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 11th, 2004, 03:10 PM
Registered User
 
Join Date: Mar 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Dividing contents of 1 excel file into many

I'm trying to make a macro that does the following:
- Asks how many new excel files you'd like to create
- Counts all of the records from the main file and divides them up evenly between the new files

For instance, my main file will likely have 500 records. If I say I want 5 files, I want it to count how many records the main file contains (500), and create 5 new files with 100 records each.

I'm very new to VBA and have no idea on the syntax to use.

Thanks,
Wire

 
Old April 12th, 2004, 05:44 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 150
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You may use the END PROPERTY to locate the bottom last row. Look it up in the vba help file.

Use INPUTBOX METHOD to catch the number of workbooks/sheets you need. Lookup the method in vba help file.

Start the macrorecorder and create a wbk/sheet. Cut or copy/paste the content from your main sheet to the other wbk/sheet. Stop the recorder and you'll have the code you need to do the actual transfer of data.

The rest is footwork. Make the necessary calculations and loops to repeat the procedure.





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to convert Excel(xls) contents into HTML manish.sharma04 XSLT 1 July 29th, 2013 04:42 AM
how to sorti file contents lakshmi_annayappa Java Basics 4 March 20th, 2008 05:26 AM
export the contents of Datagrid to Excel file softsea VS.NET 2002/2003 0 October 4th, 2006 02:38 PM
Copy contents of Word doc & Paste in Excel - How?? robear Javascript How-To 1 August 23rd, 2006 03:22 PM
How to Copy contents of Word doc & Paste in Excel robear Pro PHP 0 August 21st, 2006 12:25 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.