Finding the last unused row in a column

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

This is an example of how I would like the file to look:

Column A Column B
123456 5.00
123456 5.00
123456 5.00
ABCDEFG 15.00

The ABCDEFG is the account I would like to add at the bottom of the file.
The 15.00 is the column that I would like to sum =sum(B1:whatever). The
issue I am running
into is that the row number changes every month depending on how many pulls
in the report I run. This is what I was trying to use
but it placed the account number in every row under column A. I didn't know
where to even begin for the sum formula.. I would like to incorporate this
into the macro that I currently run... Any suggestions?

Range("A2").Select
LastRow = Cells(Rows.Count, "E").End(xlUp).Row
Range("A2").Resize(LastRow - 1).FormulaR1C1 = "4651020098"
 
something like
Sub addcol()
lastrow = Cells(Rows.Count, "a").End(xlUp).Row
Cells(lastrow + 1, "a").Value = _
Application.Sum(Range("a2:a" & lastrow))


End Sub
 
Is this for the sum formula or the first one? Do I need to put something
between the parenthesis?
Sub addcol()
--
Thanks a bunch!
rojobrown


Don Guillett said:
something like
Sub addcol()
lastrow = Cells(Rows.Count, "a").End(xlUp).Row
Cells(lastrow + 1, "a").Value = _
Application.Sum(Range("a2:a" & lastrow))


End Sub
 
Sub addcol()
lastrow = Cells(Rows.Count, "a").End(xlUp).Row
Cells(lastrow + 1, "a") = "ABCDEFG"
Cells(lastrow + 1, "a").Value = _
Application.Sum(Range("b2:b" & lastrow))
End Sub

--
Don Guillett
SalesAid Software
(e-mail address removed)
rojobrown said:
Is this for the sum formula or the first one? Do I need to put something
between the parenthesis?
Sub addcol()
 
I've included it in my macro but still keep getting the error "compile error:
Expected End Sub"... I've tried removing it but it still doesn't work. Any
suggestions?
 
It might be helpful if you posted your entire macro. No mindreader
 
It would still be helpful, for archival purposes, to post your entire macro.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top