#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default Macro help

Do anyone know if i want to set a macro which i want to comprise 2 elements:

1: total underline
2: sum ("Sum" function in Excel which automatically sum up all the cells
with figures)

Every time i set, the no. of cells to be added are fixed. for example, Col A
has 3 cells to sum up; when i apply it to Col B which has 5 cells, it also
only add up the last 3 cells, not 5.

Can anyone advise me on this matter?

Thank you so much.

--
New user
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,344
Default Macro help

Hi,

How is your macro supposed to know how far up to go? Do all the cells need
values or do you some from the current cell to row 1 or column A as the case
may be?

--
Thanks,
Shane Devenshire


"New user" wrote:

Do anyone know if i want to set a macro which i want to comprise 2 elements:

1: total underline
2: sum ("Sum" function in Excel which automatically sum up all the cells
with figures)

Every time i set, the no. of cells to be added are fixed. for example, Col A
has 3 cells to sum up; when i apply it to Col B which has 5 cells, it also
only add up the last 3 cells, not 5.

Can anyone advise me on this matter?

Thank you so much.

--
New user

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 39
Default Macro help

HI Shane!
I think that you are half way to achive what you want in a fairly complete
manner. The reason why this will not work is because when you have the
Template open, and you save it as the new file, the fact is that you still
have the same file, just with a new name. So, you don't have the other file
any more. Two choices here, either you continue this road and then save the
file, close the file and open the template again, or what I am posting here.
As you will see, this is a little more structured, but with a huge
advantage, you don't have to be worry where the file is going to be save, or
pull as once is open, the program will always know where the file was
originally open, so it will know where to save it. Unless otherwise, this is
a good and stable manner to handle this kind of projects. Ok, please copy the
following and substitute your current macro. Let me know how does it work.

Suggestion: Copy the instruction (line) below, in the "This Workbook" part,
wherethe macros and modules are, but in the side of the sheets. This will
guarantee, that even if the program crash, anywhere, as soon you click the
mouse, it will pick up all the public variables. Here is the line

Location_Identification
Argy!

=================== Program ======================

Public Actual_Book As String
Public Actual_Path As String
Public Location As String
Public Location_1 As String
Public Name As String

Function Saving()
' Macro recorded 3/3/2002 by Argemiro Calderon
Location_Identification

Windows(Actual_Book).Activate
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=Location
ActiveWorkbook.SaveAs Filename:=Location_1
Application.DisplayAlerts = True
Windows(Actual_Book).Activate
End Function
Function Location_Identification()
Actual_Book = ActiveWorkbook.Name
Actual_Path = ActiveWorkbook.Path
Location = Actual_Path & "\" & Name
Location_1 = Actual_Path & "\" & Actual_Book
End Function
Sub PrintAndClear()
' PrintAndClear Macro
' Macro recorded 9/10/2008 by me
' Keyboard Shortcut: Ctrl+Shift+Q
Actual_Book = ActiveWorkbook.Name

response = MsgBox("Do you want to Save this to a new file?", vbYesNo,
"Save As")
If response = 6 Then
Name = InputBox("Enter a Filename", "Get Filename")
If Name = "" Then
MsgBox ("The name of the file is in blank. Please check and
hit ok to continue")
End
End If
Saving
' ActiveWorkbook.SaveAs Filename:="c:\" & Name & ".xls"
End If
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True '"I think
this line is not needed"
Workbooks.Open Filename:="P:\Calculations Sheet-2008 WSO.xls"
Range("E6").Select
End Sub




"ShaneDevenshire" wrote:

Hi,

How is your macro supposed to know how far up to go? Do all the cells need
values or do you some from the current cell to row 1 or column A as the case
may be?

--
Thanks,
Shane Devenshire


"New user" wrote:

Do anyone know if i want to set a macro which i want to comprise 2 elements:

1: total underline
2: sum ("Sum" function in Excel which automatically sum up all the cells
with figures)

Every time i set, the no. of cells to be added are fixed. for example, Col A
has 3 cells to sum up; when i apply it to Col B which has 5 cells, it also
only add up the last 3 cells, not 5.

Can anyone advise me on this matter?

Thank you so much.

--
New user

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 39
Default Macro help

Hi New User:
Please disregard my previous message. That was for somebody else that has
the same subject as yours, so I got confuse. For this case, I think that you
are using a tool, macros, in an ineficient way. If it is to consolidate
numbers that might vary in the lenght depending on the column, probably you
don't need macros. What you need is Pivot Tables. Best regards

Argy


"New user" wrote:

Do anyone know if i want to set a macro which i want to comprise 2 elements:

1: total underline
2: sum ("Sum" function in Excel which automatically sum up all the cells
with figures)

Every time i set, the no. of cells to be added are fixed. for example, Col A
has 3 cells to sum up; when i apply it to Col B which has 5 cells, it also
only add up the last 3 cells, not 5.

Can anyone advise me on this matter?

Thank you so much.

--
New user

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
need help to update macro to office 2007 macro enabled workbook jatman Excel Discussion (Misc queries) 1 December 14th 07 01:57 PM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 1 June 11th 05 12:44 AM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 0 June 10th 05 03:38 PM


All times are GMT +1. The time now is 08:51 AM.

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"