Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have the following:
Named ranges within columns A & C (ie A1:A10 is named "Calc" and C1:C10 is named "Total"). Column A contains a formula that calculates a value based on fixed data and data entered into column B by a user. I would like a function that captures the current value of a cell in Column A and the value of the corresponding cell in Column C. I want these two values added together and have the new value placed back into Column C. This function should only act against the selected cells within the range. Here is an example of what I would like to do: Column A Column B Column C 1 10 4 0 2 20 3 10 3 40 5 5 4 20 1 20 5 30 5 8 etc.. If Cells C1, C3 & C4 are selected and the function is run, the resulting values should be: C1 = 10 (A1 + C1), C3 = 45 (A3 + C3), & C4 = 40 (A4 + C4). Anybody want to give this one a shot? Thanks Matt |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub AdjustTotal()
set selection = intersect(Range("Calc"),Selection.EntireRow) for each cell in Selection cell.offset(0,2).Value = cell + cell.offset(0,2).Value Next End Sub -- Regards, Tom Ogilvy "Matt" wrote in message ... I have the following: Named ranges within columns A & C (ie A1:A10 is named "Calc" and C1:C10 is named "Total"). Column A contains a formula that calculates a value based on fixed data and data entered into column B by a user. I would like a function that captures the current value of a cell in Column A and the value of the corresponding cell in Column C. I want these two values added together and have the new value placed back into Column C. This function should only act against the selected cells within the range. Here is an example of what I would like to do: Column A Column B Column C 1 10 4 0 2 20 3 10 3 40 5 5 4 20 1 20 5 30 5 8 etc.. If Cells C1, C3 & C4 are selected and the function is run, the resulting values should be: C1 = 10 (A1 + C1), C3 = 45 (A3 + C3), & C4 = 40 (A4 + C4). Anybody want to give this one a shot? Thanks Matt |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Tom...was able to use a variation of what you gave to get what I
needed. "Tom Ogilvy" wrote: Sub AdjustTotal() set selection = intersect(Range("Calc"),Selection.EntireRow) for each cell in Selection cell.offset(0,2).Value = cell + cell.offset(0,2).Value Next End Sub -- Regards, Tom Ogilvy "Matt" wrote in message ... I have the following: Named ranges within columns A & C (ie A1:A10 is named "Calc" and C1:C10 is named "Total"). Column A contains a formula that calculates a value based on fixed data and data entered into column B by a user. I would like a function that captures the current value of a cell in Column A and the value of the corresponding cell in Column C. I want these two values added together and have the new value placed back into Column C. This function should only act against the selected cells within the range. Here is an example of what I would like to do: Column A Column B Column C 1 10 4 0 2 20 3 10 3 40 5 5 4 20 1 20 5 30 5 8 etc.. If Cells C1, C3 & C4 are selected and the function is run, the resulting values should be: C1 = 10 (A1 + C1), C3 = 45 (A3 + C3), & C4 = 40 (A4 + C4). Anybody want to give this one a shot? Thanks Matt |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Max # of named ranges | Excel Discussion (Misc queries) | |||
help with named ranges please | Excel Programming | |||
Like 123, allow named ranges, and print named ranges | Excel Discussion (Misc queries) | |||
Desktop shortcut to a named Excel file - every time I open it adds a "1" to the file name - how to disable? | Setting up and Configuration of Excel | |||
named ranges - changing ranges with month selected | Excel Programming |