Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default Add function at bottom of Spreadsheet

I have a report that I download every day that varies in length each day. i
want to add in column A the text "Amount" followed by "Item count" on the
next row. Then in column B I want the dollar amount in the same row as
Amount and the Count next to Item Count. I know the functions for the
calculatoin but since the row count varies each day, how can I add this at
the end of each report with a blank row between the end of the report and
this new data.

thank so much,
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default Add function at bottom of Spreadsheet

A code that does it for you to use / adapt.......


Sub AddTotals()
Dim xLastrow As Long
xLastrow = Cells(Rows.Count, 1).End(xlUp).Row

Cells(xLastrow + 1, 1) = "Count"
Cells(xLastrow + 1, 2) = "Amount"
Cells(xLastrow + 2, 1).Formula = "=count(A1:A" & xLastrow & ")"
Cells(xLastrow + 2, 2).Formula = "=sum(A1:A" & xLastrow & ")"

End Sub

--
Cheers
Nigel



"JOUIOUI" wrote in message
...
I have a report that I download every day that varies in length each day.
i
want to add in column A the text "Amount" followed by "Item count" on the
next row. Then in column B I want the dollar amount in the same row as
Amount and the Count next to Item Count. I know the functions for the
calculatoin but since the row count varies each day, how can I add this at
the end of each report with a blank row between the end of the report and
this new data.

thank so much,



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default Add function at bottom of Spreadsheet

HI Nigel,

When I run this, it adds the text "Count" and "Amount" to Row 1, columns A &
B respectively. Why would that be if we are designating last row? Also on a
side note, I have lots of code in my macro, at what point is it just too
much? Any help you can give me is so much appreciated. Thanks

Joyce

"Nigel" wrote:

A code that does it for you to use / adapt.......


Sub AddTotals()
Dim xLastrow As Long
xLastrow = Cells(Rows.Count, 1).End(xlUp).Row

Cells(xLastrow + 1, 1) = "Count"
Cells(xLastrow + 1, 2) = "Amount"
Cells(xLastrow + 2, 1).Formula = "=count(A1:A" & xLastrow & ")"
Cells(xLastrow + 2, 2).Formula = "=sum(A1:A" & xLastrow & ")"

End Sub

--
Cheers
Nigel



"JOUIOUI" wrote in message
...
I have a report that I download every day that varies in length each day.
i
want to add in column A the text "Amount" followed by "Item count" on the
next row. Then in column B I want the dollar amount in the same row as
Amount and the Count next to Item Count. I know the functions for the
calculatoin but since the row count varies each day, how can I add this at
the end of each report with a blank row between the end of the report and
this new data.

thank so much,




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default Add function at bottom of Spreadsheet

The code as supplied was designed to run against the active sheet. If this
is not the case then .... change it to the following (note you must name the
sheet to your reference and there are decimal points (.) to add to the range
references see code below)

Sub AddTotals()
Dim xLastrow As Long

With sheets("Sheet1") ' << change to sheet name as required

xLastrow = .Cells(.Rows.Count, 1).End(xlUp).Row

.Cells(xLastrow + 1, 1) = "Count"
.Cells(xLastrow + 1, 2) = "Amount"
.Cells(xLastrow + 2, 1).Formula = "=count(A1:A" & xLastrow & ")"
.Cells(xLastrow + 2, 2).Formula = "=sum(A1:A" & xLastrow & ")"

End With

End Sub

Cheers
Nigel

"JOUIOUI" wrote:

HI Nigel,

When I run this, it adds the text "Count" and "Amount" to Row 1, columns A &
B respectively. Why would that be if we are designating last row? Also on a
side note, I have lots of code in my macro, at what point is it just too
much? Any help you can give me is so much appreciated. Thanks

Joyce

"Nigel" wrote:

A code that does it for you to use / adapt.......


Sub AddTotals()
Dim xLastrow As Long
xLastrow = Cells(Rows.Count, 1).End(xlUp).Row

Cells(xLastrow + 1, 1) = "Count"
Cells(xLastrow + 1, 2) = "Amount"
Cells(xLastrow + 2, 1).Formula = "=count(A1:A" & xLastrow & ")"
Cells(xLastrow + 2, 2).Formula = "=sum(A1:A" & xLastrow & ")"

End Sub

--
Cheers
Nigel



"JOUIOUI" wrote in message
...
I have a report that I download every day that varies in length each day.
i
want to add in column A the text "Amount" followed by "Item count" on the
next row. Then in column B I want the dollar amount in the same row as
Amount and the Count next to Item Count. I know the functions for the
calculatoin but since the row count varies each day, how can I add this at
the end of each report with a blank row between the end of the report and
this new data.

thank so much,




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default Add function at bottom of Spreadsheet

HI Again Nigel,

I am running it in the current sheet. I open the current sheet and run a
macro that sets up the page for printing...I copied and pasted the code into
the existing macro rso that this was the last action that was being
performed. Could it possibly be just in the wrong place of the macro; I
thought the end would be perfect... the last function being performed. I was
looking at the code, does this add the text "Count" and "Amount" to column A
and the calculation in Column B? That is what I was trying to accomplish,
perhaps I didn't make that clear. I appreciate your help, thanks so much

"Nigel RS" wrote:

The code as supplied was designed to run against the active sheet. If this
is not the case then .... change it to the following (note you must name the
sheet to your reference and there are decimal points (.) to add to the range
references see code below)

Sub AddTotals()
Dim xLastrow As Long

With sheets("Sheet1") ' << change to sheet name as required

xLastrow = .Cells(.Rows.Count, 1).End(xlUp).Row

.Cells(xLastrow + 1, 1) = "Count"
.Cells(xLastrow + 1, 2) = "Amount"
.Cells(xLastrow + 2, 1).Formula = "=count(A1:A" & xLastrow & ")"
.Cells(xLastrow + 2, 2).Formula = "=sum(A1:A" & xLastrow & ")"

End With

End Sub

Cheers
Nigel

"JOUIOUI" wrote:

HI Nigel,

When I run this, it adds the text "Count" and "Amount" to Row 1, columns A &
B respectively. Why would that be if we are designating last row? Also on a
side note, I have lots of code in my macro, at what point is it just too
much? Any help you can give me is so much appreciated. Thanks

Joyce

"Nigel" wrote:

A code that does it for you to use / adapt.......


Sub AddTotals()
Dim xLastrow As Long
xLastrow = Cells(Rows.Count, 1).End(xlUp).Row

Cells(xLastrow + 1, 1) = "Count"
Cells(xLastrow + 1, 2) = "Amount"
Cells(xLastrow + 2, 1).Formula = "=count(A1:A" & xLastrow & ")"
Cells(xLastrow + 2, 2).Formula = "=sum(A1:A" & xLastrow & ")"

End Sub

--
Cheers
Nigel



"JOUIOUI" wrote in message
...
I have a report that I download every day that varies in length each day.
i
want to add in column A the text "Amount" followed by "Item count" on the
next row. Then in column B I want the dollar amount in the same row as
Amount and the Count next to Item Count. I know the functions for the
calculatoin but since the row count varies each day, how can I add this at
the end of each report with a blank row between the end of the report and
this new data.

thank so much,





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default Add function at bottom of Spreadsheet

From what you said you need to make slight changes as follows........

Sub AddTotals()

Dim xLastrow As Long

With ActiveSheet

xLastrow = .Cells(.Rows.Count, 1).End(xlUp).Row

.Cells(xLastrow + 1, 1) = "Count"
.Cells(xLastrow + 2, 1) = "Amount"
.Cells(xLastrow + 1, 2).Formula = "=count(A1:A" & xLastrow & ")"
.Cells(xLastrow + 2, 2).Formula = "=sum(A1:A" & xLastrow & ")"

End With

End Sub


--
Cheers
Nigel



"JOUIOUI" wrote in message
...
HI Again Nigel,

I am running it in the current sheet. I open the current sheet and run a
macro that sets up the page for printing...I copied and pasted the code
into
the existing macro rso that this was the last action that was being
performed. Could it possibly be just in the wrong place of the macro; I
thought the end would be perfect... the last function being performed. I
was
looking at the code, does this add the text "Count" and "Amount" to column
A
and the calculation in Column B? That is what I was trying to accomplish,
perhaps I didn't make that clear. I appreciate your help, thanks so much

"Nigel RS" wrote:

The code as supplied was designed to run against the active sheet. If
this
is not the case then .... change it to the following (note you must name
the
sheet to your reference and there are decimal points (.) to add to the
range
references see code below)

Sub AddTotals()
Dim xLastrow As Long

With sheets("Sheet1") ' << change to sheet name as required

xLastrow = .Cells(.Rows.Count, 1).End(xlUp).Row

.Cells(xLastrow + 1, 1) = "Count"
.Cells(xLastrow + 1, 2) = "Amount"
.Cells(xLastrow + 2, 1).Formula = "=count(A1:A" & xLastrow & ")"
.Cells(xLastrow + 2, 2).Formula = "=sum(A1:A" & xLastrow & ")"

End With

End Sub

Cheers
Nigel

"JOUIOUI" wrote:

HI Nigel,

When I run this, it adds the text "Count" and "Amount" to Row 1,
columns A &
B respectively. Why would that be if we are designating last row?
Also on a
side note, I have lots of code in my macro, at what point is it just
too
much? Any help you can give me is so much appreciated. Thanks

Joyce

"Nigel" wrote:

A code that does it for you to use / adapt.......


Sub AddTotals()
Dim xLastrow As Long
xLastrow = Cells(Rows.Count, 1).End(xlUp).Row

Cells(xLastrow + 1, 1) = "Count"
Cells(xLastrow + 1, 2) = "Amount"
Cells(xLastrow + 2, 1).Formula = "=count(A1:A" & xLastrow & ")"
Cells(xLastrow + 2, 2).Formula = "=sum(A1:A" & xLastrow & ")"

End Sub

--
Cheers
Nigel



"JOUIOUI" wrote in message
...
I have a report that I download every day that varies in length each
day.
i
want to add in column A the text "Amount" followed by "Item count"
on the
next row. Then in column B I want the dollar amount in the same
row as
Amount and the Count next to Item Count. I know the functions for
the
calculatoin but since the row count varies each day, how can I add
this at
the end of each report with a blank row between the end of the
report and
this new data.

thank so much,





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
highlight from top to bottom of spreadsheet without scrolling? CMMag Excel Worksheet Functions 5 April 2nd 23 07:37 PM
How do I add tabs at the bottom of my excel spreadsheet? Rob Reginato Setting up and Configuration of Excel 4 December 31st 07 04:15 PM
How do I add tabs at the bottom of the excel spreadsheet? The Professor Excel Discussion (Misc queries) 2 August 13th 06 03:33 AM
The bottom of my spreadsheet is off the screen dpeck Excel Discussion (Misc queries) 1 November 22nd 05 04:59 PM
How can I find bottom row of a spreadsheet Robert Gillard Excel Discussion (Misc queries) 2 March 22nd 05 11:50 PM


All times are GMT +1. The time now is 01:16 PM.

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

About Us

"It's about Microsoft Excel"