Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Summarising figures - can anyone help please
I'd like to create a macro that allows me to do the following but i'm a
bit stuck - can anyone help? I want to be able to select some numeric cells (a1, a7 a12, a56 for exampel) and then run a macro which will sum the amounts and place the total in the cell that is immediately to the right of the last cell selected in the sum (eg, b56) However, in addition to this i want all of these cells (a1,a7, a12, a56 and b56) to be highlighted in someway to show that they are linked - i'm thinking a change of background color or the use of a numbered key. Any help on this would be very much appreciated --- Message posted from http://www.ExcelForum.com/ |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Summarising figures - can anyone help please
Sub Tester10()
Dim rng As Range, rng1 As Range Set rng = Selection Set rng1 = rng.Areas(rng.Areas.Count) Set rng1 = rng1(rng1.Rows.Count, rng1.Columns.Count) rng1.Offset(0, 1).Formula = "=Sum(" & rng.Address & ")" Union(rng, rng1.Offset(0, 1)).Interior.ColorIndex = 5 End Sub This is sensative to the order you select your cells. -- Regards, Tom Ogilvy ian123 wrote in message ... I'd like to create a macro that allows me to do the following but i'm a bit stuck - can anyone help? I want to be able to select some numeric cells (a1, a7 a12, a56 for exampel) and then run a macro which will sum the amounts and place the total in the cell that is immediately to the right of the last cell selected in the sum (eg, b56) However, in addition to this i want all of these cells (a1,a7, a12, a56 and b56) to be highlighted in someway to show that they are linked - i'm thinking a change of background color or the use of a numbered key. Any help on this would be very much appreciated --- Message posted from http://www.ExcelForum.com/ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Summarising figures - can anyone help please
Tom,
Thanks very much,that is excellent. However is it possible to include the option to select which color to highlight the cell or change the color each time its run. Basically, it works fine the first time i summarise the data but if i want to summarise two sets of data within the same range i am left with two summaries with the same color - which confuses the issue somewhat! Once again, many thanks - it is very much appreciated --- Message posted from http://www.ExcelForum.com/ |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Summarising figures - can anyone help please
Sub Tester10()
Dim rng As Range, rng1 As Range Set rng = Selection Set rng1 = rng.Areas(rng.Areas.Count) Set rng1 = rng1(rng1.Rows.Count, rng1.Columns.Count) rng1.Offset(0, 1).Formula = "=Sum(" & rng.Address & ")" rng1.Offset(0, 1).Select Application.Dialogs(xlDialogPatterns).Show rng.Interior.ColorIndex = _ rng1.Offset(0, 1).Interior.ColorIndex End Sub -- Regards, Tom Ogilvy Tom Ogilvy wrote in message ... Sub Tester10() Dim rng As Range, rng1 As Range Set rng = Selection Set rng1 = rng.Areas(rng.Areas.Count) Set rng1 = rng1(rng1.Rows.Count, rng1.Columns.Count) rng1.Offset(0, 1).Formula = "=Sum(" & rng.Address & ")" Union(rng, rng1.Offset(0, 1)).Interior.ColorIndex = 5 End Sub This is sensative to the order you select your cells. -- Regards, Tom Ogilvy ian123 wrote in message ... I'd like to create a macro that allows me to do the following but i'm a bit stuck - can anyone help? I want to be able to select some numeric cells (a1, a7 a12, a56 for exampel) and then run a macro which will sum the amounts and place the total in the cell that is immediately to the right of the last cell selected in the sum (eg, b56) However, in addition to this i want all of these cells (a1,a7, a12, a56 and b56) to be highlighted in someway to show that they are linked - i'm thinking a change of background color or the use of a numbered key. Any help on this would be very much appreciated --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Summarising Data | Excel Worksheet Functions | |||
Summarising Timesheets | Excel Worksheet Functions | |||
add figures to existing figures in excel | Excel Worksheet Functions | |||
Changing positive figures to minus figures | Excel Worksheet Functions | |||
Summarising scores | Excel Worksheet Functions |