+ Reply to Thread
Results 1 to 7 of 7

How to format a column (from a3 to last filled cell) as particular font with VBA

  1. #1
    Registered User
    Join Date
    09-27-2014
    Location
    Sydney, Australia
    MS-Off Ver
    2007
    Posts
    16

    How to format a column (from a3 to last filled cell) as particular font with VBA

    I'm a super noob to VBA and programming in general. I have a column A starting at A3 down to last filled cell which I want to format with font Trebuchet, Regular, 9 using VBA (Learning macro doesn't cut it for me any more) TIA John

  2. #2
    Valued Forum Contributor
    Join Date
    06-29-2014
    Location
    Australia
    MS-Off Ver
    MSO 365
    Posts
    1,098

    Re: How to format a column (from a3 to last filled cell) as particular font with VBA

    Hello John,

    Learning macro doesn't cut it for me any more
    Now, now. Don't give up yet!

    Try this:-

    Please Login or Register  to view this content.
    You may have to change the sheet name to suit. I've used the sheet code above.

    I hope that this helps.

    Cheerio,
    vcoolio.

  3. #3
    Registered User
    Join Date
    09-27-2014
    Location
    Sydney, Australia
    MS-Off Ver
    2007
    Posts
    16

    Re: How to format a column (from a3 to last filled cell) as particular font with VBA

    It has. Thanks.
    Can I expand it thus:
    Sub FormatA()

    Dim lr As Long: lr = Sheet1.Range("A" & Rows.Count).End(xlUp).Row

    With Sheet1.Range("A3:A" & lr).Font
    .Name = "Trebuchet"
    .FontStyle = "Regular"
    .Size = 9
    .HorizontalAlignment = xlCenter
    End With

    With Selection.Borders(xlEdgeRight)
    .LineStyle = xlContinuous
    .ColorIndex = xlAutomatic
    .TintAndShade = 0
    .Weight = xlThin
    End With

    End Sub

  4. #4
    Registered User
    Join Date
    09-27-2014
    Location
    Sydney, Australia
    MS-Off Ver
    2007
    Posts
    16

    Re: How to format a column (from a3 to last filled cell) as particular font with VBA

    or maybe:

    Sub FormatA()

    Dim lr As Long: lr = Sheet1.Range("A" & Rows.Count).End(xlUp).Row

    With Sheet1.Range("A3:A" & lr).Font
    .Name = "Trebuchet"
    .FontStyle = "Regular"
    .Size = 9
    .HorizontalAlignment = xlCenter
    .Borders (xlEdgeRight)
    .LineStyle = xlContinuous
    .ColorIndex = xlAutomatic
    .TintAndShade = 0
    .Weight = xlThin
    End With

    End Sub

  5. #5
    Valued Forum Contributor
    Join Date
    06-29-2014
    Location
    Australia
    MS-Off Ver
    MSO 365
    Posts
    1,098

    Re: How to format a column (from a3 to last filled cell) as particular font with VBA

    Hello John,

    See you haven't given up yet!

    Almost. They're all different properties so hence need to be treated separately:-

    Please Login or Register  to view this content.
    Cheerio,
    vcoolio.

  6. #6
    Registered User
    Join Date
    09-27-2014
    Location
    Sydney, Australia
    MS-Off Ver
    2007
    Posts
    16

    Re: How to format a column (from a3 to last filled cell) as particular font with VBA

    OK I see I've learned a lot.
    Thanks
    Last edited by JohnHedge; 04-04-2019 at 01:05 AM.

  7. #7
    Valued Forum Contributor
    Join Date
    06-29-2014
    Location
    Australia
    MS-Off Ver
    MSO 365
    Posts
    1,098

    Re: How to format a column (from a3 to last filled cell) as particular font with VBA

    You're welcome John.
    I'm glad to have been able to assist you.

    Cheerio,
    vcoolio.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 4
    Last Post: 06-26-2018, 09:19 PM
  2. If cell in Column G = X then fill 123 in Column H (and skip already filled cells)
    By MP1286 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-02-2016, 01:14 PM
  3. Help require to change the format of column D & J to devanagari font
    By mso3 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-29-2014, 09:08 PM
  4. Click an active cell to change filled and font color
    By Rocky2013 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-14-2013, 11:03 PM
  5. [SOLVED] How to force a user to use red font/lock cell only for font format?
    By ThomasCarter in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-28-2012, 08:48 AM
  6. [SOLVED] Formula for # of days since today, if blank or if cell filled in. Want in number format?
    By teenyjem in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 08-10-2012, 11:46 AM
  7. Conditional Format in a cell when 5 other cells are filled
    By raehippychick in forum Excel General
    Replies: 8
    Last Post: 04-03-2007, 06:22 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1