Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default Grouping data on seperate Worksheets

Hello,

I have an excel spreadsheet that draws monthly data from an Access Database.
This data is grouped based on months of the year and then sub grouped based
on dates during the month. what I would like to do for ease of use is have
the Spreadsheet understand that for each month it is to generate a seperate
worksheet for each month. Is this possible? And how would someone go about
coding the spreadsheet to look at the Months field and determine when to
build the new worksheet?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Grouping data on seperate Worksheets


Hi,

Here simple code taht can do it.

The code is base on a sheet Call "ACCESS DATA" with the month (in
order) in column A (y = 1) and the data start on row 2.


Sub GroupMonth()
Dim xStart As Integer
Dim xCurrent As Integer
Dim y As Integer
Dim MonthCurr As String
Dim SheetWithData As String

SheetWithData = "ACCESS DATA" 'Name of the sheet with the data
xCurrent = 2 'First row of data
y = 1 'Column where the Month to group are on the data sheet.

Sheets(SheetWithData).Select

MonthCurr = Trim(Cells(xCurrent, y))
xStart = xCurrent

Do While Len(Trim(Cells(xCurrent, y))) 0
If MonthCurr < Trim(Cells(xCurrent, y)) Then
Rows(xStart & ":" & xCurrent - 1).Select
Selection.Copy
Sheets.Add
ActiveSheet.Name = MonthCurr
Range("A1").Select
ActiveSheet.Paste

Sheets(SheetWithData).Select
MonthCurr = Trim(Cells(xCurrent, y))
xStart = xCurrent
End If
xCurrent = xCurrent + 1
Loop

Rows(xStart & ":" & xCurrent - 1).Select
Selection.Copy
Sheets.Add
ActiveSheet.Name = MonthCurr
Range("A1").Select
ActiveSheet.Paste

End Sub


Charlie
'Opener Consulting Home' (http://www.openerconsulting.com)

Cameron;176100 Wrote:
Hello,

I have an excel spreadsheet that draws monthly data from an Access
Database.
This data is grouped based on months of the year and then sub grouped
based
on dates during the month. what I would like to do for ease of use is
have
the Spreadsheet understand that for each month it is to generate a
seperate
worksheet for each month. Is this possible? And how would someone go
about
coding the spreadsheet to look at the Months field and determine when
to
build the new worksheet?



--
Charlie
------------------------------------------------------------------------
Charlie's Profile: http://www.thecodecage.com/forumz/member.php?userid=89
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=48723

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
matching & combining data from seperate worksheets sshaefer Excel Worksheet Functions 2 May 10th 10 02:47 PM
how to extract duplicated data from two seperate worksheets? simon steel Excel Worksheet Functions 4 January 9th 08 09:36 PM
create chart with data from across seperate worksheets Diz Charts and Charting in Excel 3 December 23rd 07 04:00 PM
How do I seperate data from a pivot into seperate worksheets? Shannon Excel Discussion (Misc queries) 5 August 25th 05 06:07 AM
matching data on seperate worksheets Dale[_9_] Excel Programming 2 January 24th 04 10:33 PM


All times are GMT +1. The time now is 03:18 AM.

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

About Us

"It's about Microsoft Excel"