+ Reply to Thread
Results 1 to 8 of 8

Cell value specific font size change

  1. #1
    Geoff C
    Guest

    Cell value specific font size change

    Would like to format font size in one column, according to a value in
    another, e.g. if I have the data

    A B
    1 12 X
    2 6 Y
    3 16 X
    4 9 Y
    ...

    I would like the font size of the cells in column B to be the relevant
    number in column A

    (Going to use wingding arrows in B, but they won't display here)

    Thanks,
    Geoff.

  2. #2
    Gary''s Student
    Guest

    RE: Cell value specific font size change

    For a single cell:

    Sub size_it()
    Range("B1").Font.Size = Range("A1").Value
    End Sub


    You can setup a loop to cover the full columns.
    --
    Gary's Student


    "Geoff C" wrote:

    > Would like to format font size in one column, according to a value in
    > another, e.g. if I have the data
    >
    > A B
    > 1 12 X
    > 2 6 Y
    > 3 16 X
    > 4 9 Y
    > ..
    >
    > I would like the font size of the cells in column B to be the relevant
    > number in column A
    >
    > (Going to use wingding arrows in B, but they won't display here)
    >
    > Thanks,
    > Geoff.


  3. #3
    Ron de Bruin
    Guest

    Re: Cell value specific font size change

    Hi Geoff

    You can try this event in the sheet module
    If you fill in a number in A the font change in B

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Application.Intersect(Range("A:A"), Target) Is Nothing Then
    If IsNumeric(Target) Then
    Target.Offset(0, 1).Font.Size = Target.Value
    End If
    End If
    End Sub


    --
    Regards Ron de Bruin
    http://www.rondebruin.nl


    "Geoff C" <GeoffC@discussions.microsoft.com> wrote in message news:54820300-D8CC-4D1F-B98E-77F45CD349CE@microsoft.com...
    > Would like to format font size in one column, according to a value in
    > another, e.g. if I have the data
    >
    > A B
    > 1 12 X
    > 2 6 Y
    > 3 16 X
    > 4 9 Y
    > ..
    >
    > I would like the font size of the cells in column B to be the relevant
    > number in column A
    >
    > (Going to use wingding arrows in B, but they won't display here)
    >
    > Thanks,
    > Geoff.




  4. #4
    Norman Jones
    Guest

    Re: Cell value specific font size change

    Hi Geoff,

    Try:

    '=============>>
    Public Sub Tester()
    Dim SH As Worksheet
    Dim rng As Range
    Dim rCell As Range

    Set SH = Sheets("Sheet1") '<<==== CHANGE
    Set rng = SH.Range("B1:B10") '<<==== CHANGE

    For Each rCell In rng.Cells
    With rCell
    .Font.Size = .Offset(0, -1).Font.Size
    End With
    Next rCell

    End Sub
    '<<=============


    ---
    Regards,
    Norman



    "Geoff C" <GeoffC@discussions.microsoft.com> wrote in message
    news:54820300-D8CC-4D1F-B98E-77F45CD349CE@microsoft.com...
    > Would like to format font size in one column, according to a value in
    > another, e.g. if I have the data
    >
    > A B
    > 1 12 X
    > 2 6 Y
    > 3 16 X
    > 4 9 Y
    > ..
    >
    > I would like the font size of the cells in column B to be the relevant
    > number in column A
    >
    > (Going to use wingding arrows in B, but they won't display here)
    >
    > Thanks,
    > Geoff.




  5. #5
    Geoff C
    Guest

    RE: Cell value specific font size change

    Sorry for being dim, but it's the loop I need help with!

    "Gary''s Student" wrote:

    > For a single cell:
    >
    > Sub size_it()
    > Range("B1").Font.Size = Range("A1").Value
    > End Sub
    >
    >
    > You can setup a loop to cover the full columns.
    > --
    > Gary's Student
    >
    >
    > "Geoff C" wrote:
    >
    > > Would like to format font size in one column, according to a value in
    > > another, e.g. if I have the data
    > >
    > > A B
    > > 1 12 X
    > > 2 6 Y
    > > 3 16 X
    > > 4 9 Y
    > > ..
    > >
    > > I would like the font size of the cells in column B to be the relevant
    > > number in column A
    > >
    > > (Going to use wingding arrows in B, but they won't display here)
    > >
    > > Thanks,
    > > Geoff.


  6. #6
    Gary''s Student
    Guest

    RE: Cell value specific font size change

    Hi Geoff:

    Sub size_it()
    Dim i As Integer
    For i = 1 To 10
    Cells(i, 2).Font.Size = Cells(i, 1).Value
    Next
    End Sub

    The loop is set up to run over 10 items. This is an example of the
    advantage of using CELLS() over RANGE() if you want to process blocks of
    cells by row x column.
    --
    Gary's Student


    "Geoff C" wrote:

    > Sorry for being dim, but it's the loop I need help with!
    >
    > "Gary''s Student" wrote:
    >
    > > For a single cell:
    > >
    > > Sub size_it()
    > > Range("B1").Font.Size = Range("A1").Value
    > > End Sub
    > >
    > >
    > > You can setup a loop to cover the full columns.
    > > --
    > > Gary's Student
    > >
    > >
    > > "Geoff C" wrote:
    > >
    > > > Would like to format font size in one column, according to a value in
    > > > another, e.g. if I have the data
    > > >
    > > > A B
    > > > 1 12 X
    > > > 2 6 Y
    > > > 3 16 X
    > > > 4 9 Y
    > > > ..
    > > >
    > > > I would like the font size of the cells in column B to be the relevant
    > > > number in column A
    > > >
    > > > (Going to use wingding arrows in B, but they won't display here)
    > > >
    > > > Thanks,
    > > > Geoff.


  7. #7
    Norman Jones
    Guest

    Re: Cell value specific font size change

    Hi Geoff.

    Reading more carefully, change:

    > .Font.Size = .Offset(0, -1).Font.Size


    to

    > .Font.Size = .Offset(0, -1).Value


    If, however, you wish the font size to respond dynamically to changes in
    column A values, try instead Ron de Bruin's suggestion.


    ---
    Regards,
    Norman



    "Norman Jones" <normanjones@whereforartthou.com> wrote in message
    news:ez5H8mOKGHA.2696@TK2MSFTNGP14.phx.gbl...
    > Hi Geoff,
    >
    > Try:
    >
    > '=============>>
    > Public Sub Tester()
    > Dim SH As Worksheet
    > Dim rng As Range
    > Dim rCell As Range
    >
    > Set SH = Sheets("Sheet1") '<<==== CHANGE
    > Set rng = SH.Range("B1:B10") '<<==== CHANGE
    >
    > For Each rCell In rng.Cells
    > With rCell
    > .Font.Size = .Offset(0, -1).Font.Size
    > End With
    > Next rCell
    >
    > End Sub
    > '<<=============
    >
    >
    > ---
    > Regards,
    > Norman




  8. #8
    Geoff C
    Guest

    RE: Cell value specific font size change

    Thanks to all of you for your suggestions. Not only is my request answered,
    I've learnt about seven other things!

    "Geoff C" wrote:

    > Would like to format font size in one column, according to a value in
    > another, e.g. if I have the data
    >
    > A B
    > 1 12 X
    > 2 6 Y
    > 3 16 X
    > 4 9 Y
    > ..
    >
    > I would like the font size of the cells in column B to be the relevant
    > number in column A
    >
    > (Going to use wingding arrows in B, but they won't display here)
    >
    > Thanks,
    > Geoff.


+ 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