Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
extract data from another worksheet | Excel Discussion (Misc queries) | |||
Compare spreadsheets & then extract data | Excel Discussion (Misc queries) | |||
Macro to Extract Template Data to New Worksheet | Excel Worksheet Functions | |||
select and extract rows of data to new excel worksheet | Excel Worksheet Functions | |||
Excel - Extract data from one worksheet to many spreadsheets ... | Excel Programming |