Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using Named Columns in a formula within a VBA Macro
Hi,
I have 2 columns, let's say A and B and I named them ColA and ColB correspondingly. I want to be able to write something like this: Question #1: Cell (10,10) = ColA+ColB Question #2 ColB = ColA+1 Could some one provide the syntax for each of the above please? Thank you much ekareem |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using Named Columns in a formula within a VBA Macro
By my interpretation of the questions:
A#1 ActiveSheet.Cells(10, 10) = WorksheetFunction.Sum(Range("ColA")) _ + WorksheetFunction,Sum(Range("ColB")) A#2 Is not logica if ColB is a name for a range of cells, it would generate and error because it would be attempting to use an Object as a variable in one case, or attempting to make several cells equal to a single value, which would also throw an error A named range is nothing more than a string variable for a range address. Therefore, it must be used in the same manner as a range address.. "ekareem" wrote in message ... Hi, I have 2 columns, let's say A and B and I named them ColA and ColB correspondingly. I want to be able to write something like this: Question #1: Cell (10,10) = ColA+ColB Question #2 ColB = ColA+1 Could some one provide the syntax for each of the above please? Thank you much ekareem |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using Named Columns in a formula within a VBA Macro
On Jan 2, 3:04*am, "JLGWhiz" wrote:
By my interpretation of the questions: A#1 ActiveSheet.Cells(10, 10) = WorksheetFunction.Sum(Range("ColA")) _ * * * * * * * * * * * * * * * * * * * * * * * *+ WorksheetFunction,Sum(Range("ColB")) A#2 Is not logica if ColB is a name for a range of cells, it would generate and error because it would be attempting to use an Object *as a variable in one case, or attempting to make several cells equal *to a single value, which would also throw an error *A named range is nothing more than a string variable for a range address. *Therefore, it must be used in the same manner as a range address.. "ekareem" wrote in message ... Hi, I have 2 columns, let's say A and B and I named them ColA and ColB correspondingly. I want to be able to write something like this: Question #1: Cell (10,10) = ColA+ColB Question #2 ColB = ColA+1 Could some one provide the syntax for each of the above please? Thank you much ekareem- Hide quoted text - - Show quoted text - ABOUT Question #1: TRY THIS MAY BE HELPFUL Sub SUMME() Dim COLA, COLB As Range Set COLA = Range("A:A") Set COLB = Range("B:B") ActiveSheet.Cells(10, 10) = Application.WorksheetFunction.Sum(COLA) _ + Application.WorksheetFunction.Sum(COLB) End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro or formula to compare columns and give a result of the odd o | Excel Discussion (Misc queries) | |||
Trying to use Lookup with Named Columns | Excel Worksheet Functions | |||
Named Range Macro Formula | Excel Programming | |||
Named Range Macro Formula | Excel Programming | |||
How can I sum data on a row from certain named columns? | Excel Worksheet Functions |