none
Help With Formatting VBA RRS feed

  • Question

  • 'RECEIVED CODE FROM HANS TO FIND LAST ROW WITH DATA +2:

    Dim r As Long
        r = Cells.Find(What:="*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
        With Range("A" & r & ":L" & r)
            .Font.Name = "Calibri"
            .Interior.Color = vbYellow
            .NumberFormat = "0.00"
        End With

    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    Works great!

    I need to do 2 other things:

    1) Add a text value to r in A: & center over selection A:L

    Dim r As Long
        r = Cells.Find(What:="*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
        
           USED THIS BUT ENDING UP IN MIDDLE OF L:!
        ActiveCell = Range("A" & r)
        ActiveCell.Value = "Estimated True Up Total"

    2) 2) Format a total in r as currency/2 decimels/aligned to right.

    THANKS AGAIN!!!

        

    Wednesday, February 4, 2015 12:54 AM

Answers

  • Hi amywolfie,

    >>1) Add a text value to r in A: & center over selection A:L<<
    Which column did you want to insert the text? We can referent to the column with the name of column and to refer to the specific row of column we can add a row number behind the column name. Here is a sample to refer to cell F5: Range("F5").

    >>Format a total in r as currency/2 decimels/aligned to right.<<

    I am not able to undersand what format you wantd. However, based on my understanding, we can use Range.NumberFormat to represent the format code for the object. Also if we didn't know the specific format we want, we can record a macro and set the format manually.

    Also here are some useful links for you learding Excel developing:
    How Do I... with Cells and Ranges

    Object model reference (Excel 2013 developer reference)

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, February 6, 2015 2:38 AM
    Moderator