Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default excel macro to extract data from one worksheet to many spreadsheets

Hi all

is there a macro i can write for the following:


I have one worksheet with extracted data, lets say as an example
columns a-g are populated with data, however each of the rows contains
mulitple data lines for each record for different dates.


The columns could contain, name, job title, course start, course
finish, course title, cost centre, cost (£).


I would like to extract the data from the one worksheet to many
spreadsheets, but would like it to sort the data in the following way
(as an example):


Course Title Total cost cost centre


i would like to have one line for each of the course titles (rather
than multiple lines) sorted by cost centre and the macro should be able

to take all the mulitple data and translate it into one line for each.


I appreciate any help

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default excel macro to extract data from one worksheet to many spreadsheets


It looks as just a perfect case for a pivot table.

Doing this with a macro can certainly be done, but is some work.
For the example you described the one below may be made to work with
adjustments.
Assume ColA has CourseTitle, ColB has CourseCost and ColC has
CostCenter data:

Sub PickData()
'Sheets("Base") is the sheet you have all the data
'Sheets("Selection1") is the sheet you want to copy stuff over
Sheets("Base").Select
Range("A1").Select

Do Until ActiveCell.Offset(1, 0) = Empty
ActiveCell.Offset(1, 0).Select
CTitle = ActiveCell
CCost = ActiveCell.Offset(0, 1)
CostCtr = ActiveCell.Offset(0, 2)

Sheets("Selection1").Select
Range("A1").Select

Do Until ActiveCell = Empty
ActiveCell.Offset(1, 0).Select
If ActiveCell = CTitle Then
ActiveCell.Offset(0, 1) = ActiveCell.Offset(0, 1) + CCost
ActiveCell.Offset(0, 2) = ActiveCell.Offset(0, 2) & " , " &
CostCtr
Range("A1").Select
Sheets("Base").Select
GoTo 44
ElseIf ActiveCell = Empty Then
ActiveCell.FormulaR1C1 = CTitle
ActiveCell.Offset(0, 1).FormulaR1C1 = CCost
ActiveCell.Offset(0, 2).FormulaR1C1 = CostCtr
Range("A1").Select
Sheets("Base").Select
GoTo 44
End If
Loop

44 Loop

End Sub


--
Gabor
------------------------------------------------------------------------
Gabor's Profile: http://www.excelforum.com/member.php...fo&userid=6179
View this thread: http://www.excelforum.com/showthread...hreadid=531348

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
extract data from another worksheet G&GSolutions Excel Discussion (Misc queries) 0 February 25th 09 02:29 PM
Compare spreadsheets & then extract data G&GSolutions Excel Discussion (Misc queries) 2 February 25th 09 06:07 AM
Macro to Extract Template Data to New Worksheet CaymanCarrie Excel Worksheet Functions 0 January 25th 08 07:11 PM
select and extract rows of data to new excel worksheet Cazstan Excel Worksheet Functions 1 July 23rd 07 11:03 PM
Excel - Extract data from one worksheet to many spreadsheets ... [email protected] Excel Programming 1 April 10th 06 02:21 AM


All times are GMT +1. The time now is 05:45 PM.

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"