View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default Add Total to End of columns


You can get the last filled row using the below code and then use that in the
formula or for calculation

'Last row filled in Column A
lngLastRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row

If this post helps click Yes
---------------
Jacob Skaria


"vivi" wrote:

Hi there, my query is very complicated and hope someone can help me!!!

I have created 2 tabs, one is for data entry (Man days entry) and the second
one is for calculations (Rate * Days) and variance calculations. For the
calculation tab, i have created a macro and so far it is working fine.
Basically it says if there is an entry in the "Data Entry" Tab in Cell A2,
then calcuate in the "Costs" tab and put the result in Cell A2. The total
file is trying to put monthly budget, actual and forecast for the next 5
years in one tab, hence it is Column A to IE.

I use Do Until, IF function and looping the code to calculate for me.
However, i am stuck not knowing how to add rows to the end of the "Calculated
Cost" within the calculated tab as user can insert as many lines as they want
in the "Data Entry Tab". i.e. the number of rows varies - it could be from 20
rows to 50 rows, etc

I would like:
1. add a which total up Cell A2:Cell A (wherever) underneath the costs for
each month
2. add a blank row underneath the total and add another row again which puts
in a subtotal function (as user uses autofilter for specific
departments/grades/name, it is necessary for them to have this function).

I would give you the code I've entered so far, but it is very long and think
it is not useful here...but I can supply it if this is necessary!!

I hope someone can help me, I am sorry if I have confused and over
complicated this!!

Thanks a lot in advance

Vivi