+ Reply to Thread
Results 1 to 4 of 4

VBA Conditional formatting to change font size

  1. #1
    Registered User
    Join Date
    03-05-2018
    Location
    Hong Kong
    MS-Off Ver
    2016
    Posts
    2

    VBA Conditional formatting to change font size

    I am wondering is there any code that I could use to change the font size based on their ranking?
    Say I have 8 cells with number 1-8, and I want to change the font size of the top 3 numbers (i.e. 6,7,8) to be 16.
    I have searched in the forum that there are codes that use conditional formatting to change the font size, but not according to the top-bottom rule...
    Thanks in advance!

  2. #2
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: VBA Conditional formatting to change font size

    Welcome to the forum

    You cannot use Conditional Formatting to change font size
    Conditional formatting is a bit of an illusion and does not change the actual properties of a cell
    So the only way to do this is with vba
    Test in attached workbook by amending values in columnA

    This goes in sheet module (amend range to match your needs)
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by kev_; 03-05-2018 at 07:47 AM.
    Click *Add Reputation to thank those who helped you. Ask if anything is not clear

  3. #3
    Registered User
    Join Date
    03-05-2018
    Location
    Hong Kong
    MS-Off Ver
    2016
    Posts
    2

    Re: VBA Conditional formatting to change font size

    Thank you so much for your file and suggestion!
    I have some follow-up questions, if I want the 1st to be font 18, 2nd to be font 16, 3rd to be font 12, how should I amend the script?
    Also, if I want to apply it to multiple columns, how should I amend to script as well?

  4. #4
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: VBA Conditional formatting to change font size

    Amend the sizes to suit your needs
    - this makes everything obvious for your first test
    - font size for the whole row is amended
    Please Login or Register  to view this content.
    To alter font sizes in columns A, C & E you could replace:
    Please Login or Register  to view this content.
    With:
    Please Login or Register  to view this content.
    Or with:
    Please Login or Register  to view this content.
    Last edited by kev_; 03-05-2018 at 08:40 AM.

+ 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. Conditional Formatting Font size
    By turist in forum Excel General
    Replies: 3
    Last Post: 11-25-2013, 01:53 AM
  2. Conditional Formatting Font size
    By turist in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-24-2013, 09:34 PM
  3. Replies: 6
    Last Post: 07-18-2013, 04:16 AM
  4. VB script to do conditional formatting of font size
    By Antila in forum Excel General
    Replies: 4
    Last Post: 06-20-2011, 01:50 PM
  5. 'Conditional Formatting' CODE to change Font Size
    By trickyricky in forum Excel General
    Replies: 5
    Last Post: 03-26-2011, 12:58 PM
  6. Conditional Change of Font Size
    By svaiskau in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-07-2007, 03:23 PM
  7. Replies: 1
    Last Post: 01-06-2005, 07:06 PM

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