Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 94
Default Inserting a row below last row of data to Sum total

I would like to be able automatically insert a row below the last row of data
that would have the word Total displayed in the column AC and then
calculate the total Sum in column AF. Is this possible
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 133
Default Inserting a row below last row of data to Sum total

Do you need a macro? Are you adding column AF data ?
Daniel

I would like to be able automatically insert a row below the last row of data
that would have the word Total displayed in the column AC and then
calculate the total Sum in column AF. Is this possible



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Inserting a row below last row of data to Sum total

Try this small macro or adapt it to your use:

Sub NewRow()
n = Cells(Rows.Count, "AF").End(xlUp).Row + 1
Cells(n, "AC").Value = "Total"
Cells(n, "AF").Formula = "=sum(AF1:AF" & n - 1 & ")"
End Sub



Macros are very easy to install and use:

1. ALT-F11 brings up the VBE window
2. ALT-I
ALT-M opens a fresh module
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To remove the macro:

1. bring up the VBE window as above
2. clear the code out
3. close the VBE window

To use the macro from Excel:

1. ALT-F8
2. Select the macro
3. Touch RUN

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

--
Gary''s Student - gsnu200858


"aussiegirlone" wrote:

I would like to be able automatically insert a row below the last row of data
that would have the word Total displayed in the column AC and then
calculate the total Sum in column AF. Is this possible

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 94
Default Inserting a row below last row of data to Sum total

Yes I need a macro. AF already has the subtotals

"aussiegirlone" wrote:

I would like to be able automatically insert a row below the last row of data
that would have the word Total displayed in the column AC and then
calculate the total Sum in column AF. Is this possible

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 94
Default Inserting a row below last row of data to Sum total

Yes I need a macro to find the last row of data and then below that, insert a
row with the word "Total!" in the cell AC? and then sum all the Cells
above. The sheet has headers from A1 to AF1 and the column AF1 has the
subtotals. Are you adding column AF data ? Yes All columns have data in them

"Daniel.C" wrote:

Do you need a macro? Are you adding column AF data ?
Daniel

I would like to be able automatically insert a row below the last row of data
that would have the word Total displayed in the column AC and then
calculate the total Sum in column AF. Is this possible






  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 94
Default Inserting a row below last row of data to Sum total

This macro is finding the first row of data below the header and then
inserting below it the row to total and then sum it. it is not finding the
last row of data below the header to insert the row total and then sum it

"Gary''s Student" wrote:

Try this small macro or adapt it to your use:

Sub NewRow()
n = Cells(Rows.Count, "AF").End(xlUp).Row + 1
Cells(n, "AC").Value = "Total"
Cells(n, "AF").Formula = "=sum(AF1:AF" & n - 1 & ")"
End Sub



Macros are very easy to install and use:

1. ALT-F11 brings up the VBE window
2. ALT-I
ALT-M opens a fresh module
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To remove the macro:

1. bring up the VBE window as above
2. clear the code out
3. close the VBE window

To use the macro from Excel:

1. ALT-F8
2. Select the macro
3. Touch RUN

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

--
Gary''s Student - gsnu200858


"aussiegirlone" wrote:

I would like to be able automatically insert a row below the last row of data
that would have the word Total displayed in the column AC and then
calculate the total Sum in column AF. Is this possible

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 133
Default Inserting a row below last row of data to Sum total

Could you post a sample of your data ?
Daniel

This macro is finding the first row of data below the header and then
inserting below it the row to total and then sum it. it is not finding the
last row of data below the header to insert the row total and then sum it

"Gary''s Student" wrote:

Try this small macro or adapt it to your use:

Sub NewRow()
n = Cells(Rows.Count, "AF").End(xlUp).Row + 1
Cells(n, "AC").Value = "Total"
Cells(n, "AF").Formula = "=sum(AF1:AF" & n - 1 & ")"
End Sub



Macros are very easy to install and use:

1. ALT-F11 brings up the VBE window
2. ALT-I
ALT-M opens a fresh module
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To remove the macro:

1. bring up the VBE window as above
2. clear the code out
3. close the VBE window

To use the macro from Excel:

1. ALT-F8
2. Select the macro
3. Touch RUN

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

--
Gary''s Student - gsnu200858


"aussiegirlone" wrote:

I would like to be able automatically insert a row below the last row of
data that would have the word Total displayed in the column AC and then
calculate the total Sum in column AF. Is this possible



  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 94
Default Inserting a row below last row of data to Sum total

I added this code below to the macro below and it now works properly?
EndRow = Cells(Rows.Count,1).End(xlup).row
The macro now looks like this.

Sub NewRow()
EndRow = Cells(Rows.Count,1).End(xlup).row
n = Cells(Rows.Count, "AF").End(xlUp).Row + 1
Cells(n, "AC").Value = "Total"
Cells(n, "AF").Formula = "=sum(AF1:AF" & n - 1 & ")"
End Sub

Thankyou for helping me
PS: There is one more thing I'd like to ask
Can the inserted row font be formatted bold at the same time?





"Daniel.C" wrote:

Could you post a sample of your data ?
Daniel

This macro is finding the first row of data below the header and then
inserting below it the row to total and then sum it. it is not finding the
last row of data below the header to insert the row total and then sum it

"Gary''s Student" wrote:

Try this small macro or adapt it to your use:

Sub NewRow()
n = Cells(Rows.Count, "AF").End(xlUp).Row + 1
Cells(n, "AC").Value = "Total"
Cells(n, "AF").Formula = "=sum(AF1:AF" & n - 1 & ")"
End Sub



Macros are very easy to install and use:

1. ALT-F11 brings up the VBE window
2. ALT-I
ALT-M opens a fresh module
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To remove the macro:

1. bring up the VBE window as above
2. clear the code out
3. close the VBE window

To use the macro from Excel:

1. ALT-F8
2. Select the macro
3. Touch RUN

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

--
Gary''s Student - gsnu200858


"aussiegirlone" wrote:

I would like to be able automatically insert a row below the last row of
data that would have the word Total displayed in the column AC and then
calculate the total Sum in column AF. Is this possible




  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 133
Default Inserting a row below last row of data to Sum total

Union(Cells(n, "AF"), Cells(n, "AC")).Font.Bold = True
But, what's the use of EndRow ?
Daniel

I added this code below to the macro below and it now works properly?
EndRow = Cells(Rows.Count,1).End(xlup).row
The macro now looks like this.

Sub NewRow()
EndRow = Cells(Rows.Count,1).End(xlup).row
n = Cells(Rows.Count, "AF").End(xlUp).Row + 1
Cells(n, "AC").Value = "Total"
Cells(n, "AF").Formula = "=sum(AF1:AF" & n - 1 & ")"
End Sub

Thankyou for helping me
PS: There is one more thing I'd like to ask
Can the inserted row font be formatted bold at the same time?





"Daniel.C" wrote:

Could you post a sample of your data ?
Daniel

This macro is finding the first row of data below the header and then
inserting below it the row to total and then sum it. it is not finding the
last row of data below the header to insert the row total and then sum it

"Gary''s Student" wrote:

Try this small macro or adapt it to your use:

Sub NewRow()
n = Cells(Rows.Count, "AF").End(xlUp).Row + 1
Cells(n, "AC").Value = "Total"
Cells(n, "AF").Formula = "=sum(AF1:AF" & n - 1 & ")"
End Sub



Macros are very easy to install and use:

1. ALT-F11 brings up the VBE window
2. ALT-I
ALT-M opens a fresh module
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To remove the macro:

1. bring up the VBE window as above
2. clear the code out
3. close the VBE window

To use the macro from Excel:

1. ALT-F8
2. Select the macro
3. Touch RUN

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

--
Gary''s Student - gsnu200858


"aussiegirlone" wrote:

I would like to be able automatically insert a row below the last row of
data that would have the word Total displayed in the column AC and
then calculate the total Sum in column AF. Is this possible






  #10   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 94
Default Inserting a row below last row of data to Sum total

I dont know What the use of EndRow dose to the formula, all I know is that it
now goes to the end of the last row of data found and your code completes the
insertion of text and summing. Without this line of code it was going to the
first row of data found. Anyhow, it works good so thanks again.

"Daniel.C" wrote:

Union(Cells(n, "AF"), Cells(n, "AC")).Font.Bold = True
But, what's the use of EndRow ?
Daniel

I added this code below to the macro below and it now works properly?
EndRow = Cells(Rows.Count,1).End(xlup).row
The macro now looks like this.

Sub NewRow()
EndRow = Cells(Rows.Count,1).End(xlup).row
n = Cells(Rows.Count, "AF").End(xlUp).Row + 1
Cells(n, "AC").Value = "Total"
Cells(n, "AF").Formula = "=sum(AF1:AF" & n - 1 & ")"
End Sub

Thankyou for helping me
PS: There is one more thing I'd like to ask
Can the inserted row font be formatted bold at the same time?





"Daniel.C" wrote:

Could you post a sample of your data ?
Daniel

This macro is finding the first row of data below the header and then
inserting below it the row to total and then sum it. it is not finding the
last row of data below the header to insert the row total and then sum it

"Gary''s Student" wrote:

Try this small macro or adapt it to your use:

Sub NewRow()
n = Cells(Rows.Count, "AF").End(xlUp).Row + 1
Cells(n, "AC").Value = "Total"
Cells(n, "AF").Formula = "=sum(AF1:AF" & n - 1 & ")"
End Sub



Macros are very easy to install and use:

1. ALT-F11 brings up the VBE window
2. ALT-I
ALT-M opens a fresh module
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To remove the macro:

1. bring up the VBE window as above
2. clear the code out
3. close the VBE window

To use the macro from Excel:

1. ALT-F8
2. Select the macro
3. Touch RUN

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

--
Gary''s Student - gsnu200858


"aussiegirlone" wrote:

I would like to be able automatically insert a row below the last row of
data that would have the word Total displayed in the column AC and
then calculate the total Sum in column AF. Is this possible








  #11   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 94
Default Inserting a row below last row of data to Sum total

I dont know what the use of endrow done to the code. All I know is that it
found the last row of data in the sheet instead of finding the first row of
data. And your code completed the insertion of text, summing and formatting
bold. So thankyou once again for your help


"Daniel.C" wrote:

Union(Cells(n, "AF"), Cells(n, "AC")).Font.Bold = True
But, what's the use of EndRow ?
Daniel

I added this code below to the macro below and it now works properly?
EndRow = Cells(Rows.Count,1).End(xlup).row
The macro now looks like this.

Sub NewRow()
EndRow = Cells(Rows.Count,1).End(xlup).row
n = Cells(Rows.Count, "AF").End(xlUp).Row + 1
Cells(n, "AC").Value = "Total"
Cells(n, "AF").Formula = "=sum(AF1:AF" & n - 1 & ")"
End Sub

Thankyou for helping me
PS: There is one more thing I'd like to ask
Can the inserted row font be formatted bold at the same time?





"Daniel.C" wrote:

Could you post a sample of your data ?
Daniel

This macro is finding the first row of data below the header and then
inserting below it the row to total and then sum it. it is not finding the
last row of data below the header to insert the row total and then sum it

"Gary''s Student" wrote:

Try this small macro or adapt it to your use:

Sub NewRow()
n = Cells(Rows.Count, "AF").End(xlUp).Row + 1
Cells(n, "AC").Value = "Total"
Cells(n, "AF").Formula = "=sum(AF1:AF" & n - 1 & ")"
End Sub



Macros are very easy to install and use:

1. ALT-F11 brings up the VBE window
2. ALT-I
ALT-M opens a fresh module
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To remove the macro:

1. bring up the VBE window as above
2. clear the code out
3. close the VBE window

To use the macro from Excel:

1. ALT-F8
2. Select the macro
3. Touch RUN

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

--
Gary''s Student - gsnu200858


"aussiegirlone" wrote:

I would like to be able automatically insert a row below the last row of
data that would have the word Total displayed in the column AC and
then calculate the total Sum in column AF. Is this possible






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting rows and adding to total worksheet SU123 Excel Discussion (Misc queries) 3 September 12th 08 01:30 PM
locate data from a chart by inserting data into a cell Aaron Hodson \(Coversure\) Excel Worksheet Functions 3 November 1st 07 12:12 PM
lock a total row below a list & allow inserting in the list? Curious Consultant Excel Worksheet Functions 2 May 11th 07 04:14 PM
Inserting Copied Row To Always Insert Above Sub Total Jamess Excel Worksheet Functions 0 November 9th 05 11:09 PM
Adding Data Using Multiple Worksheets to Total into a Grand Total Lillie Excel Worksheet Functions 1 April 19th 05 08:34 PM


All times are GMT +1. The time now is 11:14 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright 2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"