Results 1 to 6 of 6

How to change the font size based on value of the cell?

Threaded View

  1. #1
    Forum Contributor
    Join Date
    05-02-2013
    Location
    Indiana
    MS-Off Ver
    Microsoft 365 (Subscription)
    Posts
    192

    How to change the font size based on value of the cell?

    Hello,

    I would like to change the font size of cell C4 to 22, if the content of cell C4 is numeric and 16 if the content is a text. I have written a macro to do this; however, I would like to make it automatically change any time the content of cell C4 changes. Currently, I have a button to click to run the macro. The VBA checks cell C4 and changes the font size accordingly. How can I program the macro to recognize when cell C4 changes and apply these conditions automatically? Is there a way to do it without VBA? I do not think that conditional formatting will work.

    Sub Button3_Click()
    
         If IsNumeric(Worksheets("Sheet1").Cells(4, 3)) Or Worksheets("Sheet1").Cells(4, 3) = "" Then
            Worksheets("Sheet1").Range("C4").Font.Size = 22
        Else
            Worksheets("Sheet1").Range("C4").Font.Size = 16
        End If
        
    End Sub
    Thank you for your help!

    redsab
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 6
    Last Post: 07-18-2013, 04:16 AM
  2. [SOLVED] Change default font and font size on COMMENTS in cells
    By Thistledown in forum Excel General
    Replies: 4
    Last Post: 11-23-2012, 09:26 AM
  3. [SOLVED] Change font size in row based on cell value within specific column
    By Fullalove in forum Excel General
    Replies: 14
    Last Post: 06-27-2012, 05:51 PM
  4. Change font size based on a Cell Value
    By kalyanverma in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-21-2008, 11:39 AM
  5. [SOLVED] Cell value specific font size change
    By Geoff C in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-06-2006, 05:15 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