• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

MACRO - Auto sum on last black row and save file as .prn

dingdang

Member
I have systeme generated text file which I want to convert in excel coloumn wise, I am recording the Macro for that. I want additional code for below .

1. Go to last blank cell in coloum A and type " Total"
2. Sum of column B1 till last row of B
3. Type "Report" in column C
4. auto save file in c:\Report\( with name "ARN-ddmmyy hh:mm.prn") e.g C:\report\ARN280815 10:37.prn

e.g
column A B C
2121 -----100.00 -------jonh
1111 -----200.00------- macho
3333 -----300.00 -------jeorge

(code required for below output)
Total ----600.00 -----Report

Thanks
 
Something like this..

Code:
Dim lrow As Range
Set lrow = ActiveSheet.Range("A" & Rows.Count).End(xlUp)(2)
With lrow
    .Value = "Total"
    .Offset(, 1) = Evaluate("=sum(b2:b" & .Row - 1 & ")")
    .Offset(, 2) = "Report"
End With
 
Back
Top