Consulting

Results 1 to 4 of 4

Thread: Solved: Lastrow +

  1. #1
    VBAX Mentor
    Joined
    Aug 2011
    Posts
    353
    Location

    Solved: Lastrow +

    I am trying to add stuff after the last row. Please see the attached spreadsheet. I would like to add the word "MERRILL" in column c, cell lastrow+3, the word "Fidelity" in column C, cell lastrow+5, and the word "TOTAL" in column C, cell lastrow + 7. Can you help with this??
    Attached Files Attached Files

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Master
    Joined
    Jan 2005
    Location
    Porto Alegre - RS - Brasil
    Posts
    1,219
    Location
    Klartigue,

    you can use this:
    [VBA]Sub AddText()
    Dim mRow As Long
    mRow = Cells(1048576, 3).End(xlUp).Row
    Cells(mRow + 3, 3).Value = "MERRILL"
    Cells(mRow + 5, 3).Value = "FIDELITY"
    Cells(mRow + 7, 3).Value = "TOTAL"
    End Sub
    [/VBA]
    Best Regards,

    Carlos Paleo.

    To every problem there is a solution, even if I dont know it, so this posting is provided "AS IS" with no warranties.

    If Debugging is harder than writing a program and your code is as good as you can possibly make
    it, then by definition you're not smart enough to debug it.




    http://www.mugrs.org

  3. #3
    VBAX Mentor
    Joined
    Aug 2011
    Posts
    353
    Location
    That said there was an error with mrow but I used this VBA and it works:

    [VBA]Sub Merrill()
    Dim lastrow As Long
    Dim i As Long

    With ActiveSheet

    lastrow = .Cells(.Rows.Count, "C").End(xlUp).Row + 2
    .Cells(lastrow + 1, 8).Value = "MERRILL LYNCH"

    End With
    End Sub
    Sub Fidelity()
    Dim lastrow As Long
    Dim i As Long

    With ActiveSheet
    lastrow = .Cells(.Rows.Count, "C").End(xlUp).Row + 3

    .Cells(lastrow + 1, 8).Value = "FIDELITY"
    End With
    End Sub
    Sub Total()
    Dim lastrow As Long
    Dim i As Long

    With ActiveSheet
    lastrow = .Cells(.Rows.Count, "C").End(xlUp).Row + 4

    .Cells(lastrow + 1, 8).Value = "TOTAL"
    End With
    End Sub[/VBA]

    Thanks for your help!

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Why is it in separate subs?
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •