Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Macro to split workbook into several based on cell contents

Hi,

I have a worksheet with all the sales data by salesperson for ten
branches. Column A is Branch Name, B is Sales Person, C is sales
figures.

I want to create a macro which splits this into ten workbooks, named by
branchname.


Can anyone suggest the easiest way ?



Rich

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro to split workbook into several based on cell contents


Hi

Would this work?
Sub create_worksheet()
branch = "Branch Name"
sale = "Sales Persons"
figur = "Sales Figures"

rowcount = Cells(Cells.Rows.Count, "a").End(xlUp).Row
For i = 2 To rowcount
'Assuming the info is on sheet1, if not change the name
Sheets("sheet1").Activate
Range("a" & i).Select
w_name = ActiveCell.Value
Range("b" & i).Select
salep = ActiveCell.Value
Range("c" & i).Select
salef = ActiveCell.Value
Worksheets.Add
ActiveSheet.Name = w_name
ActiveSheet.Activate
Range("a1").Select
ActiveCell = branch
Range("a2").Select
ActiveCell = w_name
Range("b1").Select
ActiveCell = sale
Range("b2").Select
ActiveCell = salep
Range("c1").Select
ActiveCell = figur
Range("c2").Select
ActiveCell = salef

Next
'Assuming the info is on sheet1, if not change the name
Sheets("sheet1").Activate
End Su

--
jette
-----------------------------------------------------------------------
jetted's Profile: http://www.excelforum.com/member.php...fo&userid=1753
View this thread: http://www.excelforum.com/showthread.php?threadid=56320

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Macro to split workbook into several based on cell contents

I did this from a pivot table and used Show Pages. I then told Excel to copy
the page to a new workbook and save as sheet.name.

" wrote:

Hi,

I have a worksheet with all the sales data by salesperson for ten
branches. Column A is Branch Name, B is Sales Person, C is sales
figures.

I want to create a macro which splits this into ten workbooks, named by
branchname.


Can anyone suggest the easiest way ?



Rich


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Macro to split workbook into several based on cell contents

Try this
http://www.rondebruin.nl/copy5.htm

Try the workbook example

--
Regards Ron de Bruin
http://www.rondebruin.nl



wrote in message ps.com...
Hi,

I have a worksheet with all the sales data by salesperson for ten
branches. Column A is Branch Name, B is Sales Person, C is sales
figures.

I want to create a macro which splits this into ten workbooks, named by
branchname.


Can anyone suggest the easiest way ?



Rich



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
split contents of cell april Excel Discussion (Misc queries) 4 May 28th 09 12:05 AM
macro with input msg based on cell contents Janelle S[_2_] Excel Discussion (Misc queries) 2 February 9th 08 11:47 PM
Macro to Save As with filename based on cell contents. [email protected] Excel Programming 4 June 22nd 06 11:02 AM
Macro to move cell contents based on formatting Scott Wagner Excel Programming 2 December 23rd 05 03:22 PM
Please help! Macro to change cell contents based on cell to the left Jennifer[_8_] Excel Programming 7 March 4th 04 01:06 AM


All times are GMT +1. The time now is 08:18 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"