I'm working with the following module which will summarise the selected cells, then place the subtotal in the column 2 places to the right of the column in which the selected cells are. It also allows the user to add a colour to the selection.
However, i'd like to modify it so that instead of placing the subtotal in the column two columns to the right, it will insert a column and place the subtotal here instead.
Can anyone help? Heres the module as it is...
Sub Sub_Total()
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, 2).Formula = "=Sum(" & rng.Address & ")"
rng1.Offset(0, 2).Select
Application.Dialogs(xlDialogPatterns).Show
rng.Interior.ColorIndex = _
rng1.Offset(0, 2).Interior.ColorIndex
End Sub
Thanks in advance
Bookmarks