Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a macro that utilizes Excel AND Access, when the final report pops out
of Access, there is some more formatting that needs to be done in excel. The # of columns vary based on # of locations. I want to do some calculations of the cells going across and am trying to find a way to have it select the range and sum for example. Here is what I'm looking at: ColumnA ColumnB ColumnC ColumnD ColumnE ColumnF Part# PQ Loc1OH Loc2OH Loc3OH TOTAL AAAA 5 1 2 4 7 <-- This Sum is the ? I can get it to find the last column with: Dim LastColumn As Long LastColumn = Range("A1").End(xlToRight).Column Cells(LastColumn + 1).Select I cannot get it to select the columns before it to sum them within that selection. Also I have it set the MyValue to the number of locations right before that, so I have that number. I was trying to use IF/Then Statements with looping around between Line1: Line2: etc. But I couldn't figure out a way to select the cells over and sum them in the last column. However, I can't get it to Select Column C,D,E and sum them in F properly. I could create a hundred code sections and have it jump around in the macro according to Location numbers, but that would be terribly cumbersome and long. It will always start with Column C and sum over a # of columns based on locations. Is there any way to Have it do what I am asking for? Am I Making Sense? Thanks for any help. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to do summation of unique counts based on another variable? | Excel Worksheet Functions | |||
Variable range column summation and averaging | Excel Discussion (Misc queries) | |||
How do I perform summation over variable areas? | Excel Discussion (Misc queries) | |||
Variable for column selection | Excel Programming | |||
VBA code to perform summation and product summation | Excel Programming |