+ Reply to Thread
Results 1 to 15 of 15

Change font size in row based on cell value within specific column

  1. #1
    Registered User
    Join Date
    06-11-2012
    Location
    San Francisco, CA
    MS-Off Ver
    Excel 2010
    Posts
    26

    Change font size in row based on cell value within specific column

    I'm attempting (unsuccessfully) to create a macro that will allow me to edit the font size, color, and bold/not bold formats of a range of cells within one row based on the specific value of a cell within that range. Can anyone help? I'd very much appreciate the assistance.

    Thank you in advance.

  2. #2
    Registered User
    Join Date
    06-20-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Change font size in row based on cell value within specific column

    Hi

    How about this? Enter the value 1 in cell a1, put some other values in the other cells in row 1, and run macro....

    Please Login or Register  to view this content.

  3. #3
    Valued Forum Contributor
    Join Date
    03-25-2004
    Location
    Boston, MA US
    Posts
    1,094

    Re: Change font size in row based on cell value within specific column

    Hi,

    Or maybe something like this on the Worksheet Change event.

    Please Login or Register  to view this content.
    Steve

  4. #4
    Registered User
    Join Date
    06-11-2012
    Location
    San Francisco, CA
    MS-Off Ver
    Excel 2010
    Posts
    26

    Re: Change font size in row based on cell value within specific column

    This works, but returns an error when I change the range to include multiple rows. Can this be edited to skip rows in which the target.value does not = 1?

  5. #5
    Valued Forum Contributor
    Join Date
    03-25-2004
    Location
    Boston, MA US
    Posts
    1,094

    Re: Change font size in row based on cell value within specific column

    How about this,

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    06-11-2012
    Location
    San Francisco, CA
    MS-Off Ver
    Excel 2010
    Posts
    26

    Re: Change font size in row based on cell value within specific column

    In all honesty I can't tell. Besides that, I need the row's font: size, color, and bold to be determined by the value of this cell.

  7. #7
    Registered User
    Join Date
    06-11-2012
    Location
    San Francisco, CA
    MS-Off Ver
    Excel 2010
    Posts
    26

    Re: Change font size in row based on cell value within specific column

    The function below achieves exactly what I want, but only applies to column G. Can demonstrate how to edit it to apply the formatting changes to columns other than G while still being dependent on only the values within column G?


    Private Sub Worksheet_Change(ByVal Target As Range)

    Dim r As Range, c As Range

    Set r = Worksheets("sheet 1").Range("C220:P2000")

    For Each c In r
    With c
    If Not IsError(.Value) Then
    Select Case .Value

    Case "TOTALS - - >"
    .Font.ColorIndex = 1
    .Font.Bold = True
    .Font.Size = 20

    Case "SUBTOTALS - - >"
    .Font.ColorIndex = 1
    .Font.Bold = True
    .Font.Size = 15

    End Select
    End If
    End With
    Next c

    End Sub


    I very much appreciate all of your efforts with this, thank you.

  8. #8
    Valued Forum Contributor
    Join Date
    03-25-2004
    Location
    Boston, MA US
    Posts
    1,094

    Re: Change font size in row based on cell value within specific column

    Hi,

    What do "TOTALS-->" and "SUBTOTALS-->" represent?

    Steve

  9. #9
    Registered User
    Join Date
    06-11-2012
    Location
    San Francisco, CA
    MS-Off Ver
    Excel 2010
    Posts
    26

    Re: Change font size in row based on cell value within specific column

    Those are the values in the cells that will drive the formatting change. i.e. when the cells contain those values, the formatting should automatically change.

  10. #10
    Valued Forum Contributor
    Join Date
    03-25-2004
    Location
    Boston, MA US
    Posts
    1,094

    Re: Change font size in row based on cell value within specific column

    Hi,

    Here's a version of mine modified. Just wondering though why not just use conditional formatting?

    Please Login or Register  to view this content.
    \

    HTH
    Steve

  11. #11
    Registered User
    Join Date
    06-11-2012
    Location
    San Francisco, CA
    MS-Off Ver
    Excel 2010
    Posts
    26

    Re: Change font size in row based on cell value within specific column

    I'm not using conditional formatting because I would like the font size changed and as far as I know that can't be accomplished in conditional formatting.

    I've input your solution here and it worked, but when I change some of the font colors, i.e. from 1 to 3, I can't get it to run again. Will this macro be something that can continuously run and update my sheet as often as cell values change?

    Please forgive the naivete.

    Thanks

  12. #12
    Forum Expert
    Join Date
    06-26-2010
    Location
    Austin, TX
    MS-Off Ver
    Excel 2010
    Posts
    1,673

    Re: Change font size in row based on cell value within specific column

    Hmm, I have never tried to change the font size in Conditional Formatting and I remembered the box that showed font size in the formatting dialog box. Sure enough, though, it is not selectable.

    Pauley
    Last edited by Pauleyb; 06-20-2012 at 04:42 PM.

  13. #13
    Registered User
    Join Date
    06-11-2012
    Location
    San Francisco, CA
    MS-Off Ver
    Excel 2010
    Posts
    26

    Re: Change font size in row based on cell value within specific column

    The solution also only appears to be changing the font size and bold/not bold; the color for some reason remains unchanged. ???

  14. #14
    Registered User
    Join Date
    06-11-2012
    Location
    San Francisco, CA
    MS-Off Ver
    Excel 2010
    Posts
    26

    Re: Change font size in row based on cell value within specific column

    Can this be edited to affect only a specific range of columns?

  15. #15
    Registered User
    Join Date
    06-11-2012
    Location
    San Francisco, CA
    MS-Off Ver
    Excel 2010
    Posts
    26

    Re: Change font size in row based on cell value within specific column

    I've since been able to solve this problem utilizing a case structure. Thank you all for the help.

  16. #16
    Registered User
    Join Date
    08-25-2012
    Location
    Albuquerque, NM
    MS-Off Ver
    Excel 2003
    Posts
    0

    Re: Change font size in row based on cell value within specific column

    Hey all! I came across this forum because I'm looking for a similar solution, and I know NOTHING about writing macros.
    I want what you might consider to be a very simple macro, and very similar to what I see here (I think). Please please PLEASE help.

    I want the size of each ROW to be twice as much as the value in COLUMN D.
    Column D currently has all values assigned as a formula, Text Formatted as a Currency. If this is a problem, I can change it easily. It doesn't HAVE TO be a formula, that just makes it easy for me. It doesn't HAVE TO be currency, that's completely optional.

    You might just have to say "the font of ColumnD(x) = ColumnD(x)*2", but in the proper terms.
    I don't know.
    Anyway, that's all I need, and I'm baffled just reading other people's scripts.

    Can you guys help me? Please please please?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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