Ask Experts Questions for FREE Help !
Ask
    ssheldon's Avatar
    ssheldon Posts: 0, Reputation: 1
    New Member
     
    #1

    Jun 28, 2007, 06:34 AM
    Excel macro total row
    Hello,

    I currently have a small problem with a macro in Excel. I am pasting various amounts of rows of information into new workbooks all the time and have created a macro that will sort/tart-up the info. The problem I have is that I wish to attach a 'Total' row after the last line of information (Shown below). Now, the problem I have is that because the information I am pasting into the workbook is a different amount of lines each time, the total line is fixed on the row that the macro was created with, (this is all shown below). I want the macro to be able to distinguish the last row of the information in the workbook and then insert a 'Total' row on the next line down. This is shown below as the total line being stuck on H49:I49 (e.g. the information I pasted in was 48 lines long), so if I was to paste in information that was 100 lines long and played the macro, the total column will still be inserted into the 49th row which is in the centre of the info.


    Selection.Borders(xlEdgeRight).Line
    Selection.Borders(xlInsideVertical).Line
    Range("A49").Select
    ActiveWindow.SmallScroll Down:=6
    ActiveCell.FormulaR1C1 = "Total"
    Range("H49").Select
    ActiveCell.FormulaR1C1 = "=SUM(R[-43]C:R[-1]C)"
    Range("I49").Select
    ActiveCell.FormulaR1C1 = "=SUM(R[-43]C:R[-1]C)"
    Range("A49:I49").Select
    Selection.Font.Bold = True


    Please can you help me out with this. Hopefully I only need to replace the H49 and I49 with a final column command, but as you can see I'm not an expert at macros.

Check out some similar questions!

Excel insert row [ 2 Answers ]

Studying ECDL using ABCOL Blackboard. Unable to insert blank row. i.e. without it being numbered. To form two lines of heading a column John Clark

Excel: Macro to designate a color based on condition [ 1 Answers ]

I have an Excel which has three column. First has name(which might repeat in the coming cells) ,second has condition and the third has color. I want to count the number of color for a particular condition against each name Thanks Bhaskar KP

How to Automate a macro in excel [ 4 Answers ]

A program logs files at random in txt. abc_log.txt (example) When new info. Is added to the txt file,manualy activate macro and it does what it suppose to do, all OK there. Is there a way a macro code or excel, or perhaps a BAT program can be made to simply "detect" when new data is added...

Inserting a row in Excel [ 3 Answers ]

I am trying to insert a row and keep getting this error message that it cannot shift non blank cells off worksheet. I have never seen this before and never had a problem inserting a row, what do I do.


View more questions Search
 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.