Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() Hey all, I have a worksheet which has two columns to it and I need a third to act as a totals column for all the values in columns a and b. I'm doing it as part of a sub in vba and I need to know if there is a short way of reffering to column as I keep ending up with pages of: Range("G3").Activate ActiveCell.FormulaR1C1 = "=SUM(RC[-2]:RC[-1])" Columns("E:G").Select Range("G4").Activate ActiveCell.FormulaR1C1 = "=SUM(RC[-2]:RC[-1])" Columns("E:G").Select Range("G5").Activate ActiveCell.FormulaR1C1 = "=SUM(RC[-2]:RC[-1])" Many thanks, -- Hru48 ------------------------------------------------------------------------ Hru48's Profile: http://www.excelforum.com/member.php...o&userid=24895 View this thread: http://www.excelforum.com/showthread...hreadid=506856 |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Use these two snippets in your code. The dim statement comes after Sub.
The for...next statement goes wherever necessary. Modify range("G2:G100") as necessary. dim c as range for each c in range("G2:G1000").cells c.formular1c1="=SUM(RC[-2]:RC[-1])" next c HTH Kostis Vezerides |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Return SEARCHED Column Number of Numeric Label and Value | Excel Worksheet Functions | |||
IF/AND/OR/DATEIF Issue...sorry...long post... | Excel Worksheet Functions | |||
creating a bar graph | Excel Discussion (Misc queries) | |||
How to group similar column titles together???? | Excel Discussion (Misc queries) | |||
Return Count for LAST NonBlank Cell in each Row | Excel Worksheet Functions |