LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Need to tailor my macro code.

I have come up with a macro (shown below), that sorts out data that I
download and totals it. The problem is that the macro works for this
particular download but not for the others which change every day. I download
the spreadsheet and at the macro deletes cells, sorts the data for me, splits
it into the 3 companys I am analysing and totals the amount for each of the
companies. However the deleting of cells is fine and sorting them is also
fine. From here I am stuck. Say in the first days spreadsheet there are 1000
values corresponding to one company 2000 to another and 1500 to the other,
this changes daily. The macro needs to recognise a Company name and then
total the values which are in a seperate column corresponding to that
company.

Sub Shortfalls()
'
' Shortfalls Macro
' Macro recorded 12/07/2006 by terminal12
'

'
Columns("E:K").Select
Selection.Delete Shift:=xlToLeft
Columns("J:K").Select
Selection.Delete Shift:=xlToLeft
Columns("M:U").Select
Selection.Delete Shift:=xlToLeft
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
Columns("F:F").Select
Range("A1:L5622").Sort Key1:=Range("F2"), Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("O7").Select
ActiveCell.FormulaR1C1 = "AA Total"
Range("O8").Select
ActiveCell.FormulaR1C1 = "PR Total"
Range("O9").Select
ActiveCell.FormulaR1C1 = "HY Total"
Range("P7").Select
ActiveCell.FormulaR1C1 = "=SUM(R[-5]C[-12]:R[2049]C[-12])"
Range("P8").Select
ActiveCell.FormulaR1C1 = "=SUM(R[4601]C[-12]:R[5614]C[-12])"
Range("P9").Select
ActiveCell.FormulaR1C1 = "=SUM(R[2048]C[-12]:R[4599]C[-12])"
Range("P10").Select
End Sub


Can anyone help?

Regards

Barry
 
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
Deleting code from a macro (by a macro) Brettjg Excel Discussion (Misc queries) 2 May 8th 07 10:14 PM
Macro code to remove a macro after it executes Charles Excel Programming 4 March 22nd 06 12:11 PM
read macro code by vb code Francesco Geri Excel Programming 2 October 7th 05 10:24 AM
do anybody have a sample code for executing excel macro from vb code?<eom B Deepak Excel Programming 2 September 30th 05 09:59 AM
Macro copying macro code TNSKHelp Excel Programming 1 June 17th 05 04:59 PM


All times are GMT +1. The time now is 08:00 AM.

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"