+ Reply to Thread
Results 1 to 6 of 6

Function to adjust font properties

  1. #1
    Registered User
    Join Date
    07-12-2014
    Location
    Chicago
    MS-Off Ver
    2013
    Posts
    67

    Function to adjust font properties

    I'm not very good at writing functions, and I'm wondering if there's a way to create a function to change font size, among other things. It would look something like this:
    Please Login or Register  to view this content.
    Or to adjust fint, color, and size, it would be like this:
    Please Login or Register  to view this content.
    I only know how I would write it into a formula, and how to record it as a macro, but I can't actually write it as VBA.

    Thanks!

  2. #2
    Registered User
    Join Date
    08-06-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: Function to adjust font properties

    for the active cell you can use

    Please Login or Register  to view this content.
    (What ever size you want)
    Please Login or Register  to view this content.
    Hope this helps. If you need anything else please let me know

  3. #3
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,814

    Re: Function to adjust font properties

    A User-defined function (a VBA function procedure called from a spreadsheet cell) cannot change cell properties such as font type, color, or size. If I understand what you are asking for, I don't think you can do it in the way you are proposing.

    Conditional formatting can probably do this, and you can conceivably use a UDF as part of determining the conditions for formatting. Event code (calculation or change event, most likely) could also do this. If you can explain in more detail what you are hoping to accomplish here, we can help you put something together.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  4. #4
    Registered User
    Join Date
    07-12-2014
    Location
    Chicago
    MS-Off Ver
    2013
    Posts
    67

    Re: Function to adjust font properties

    Thank you, but I want to be able to incorporate it into formulas, for example:

    Please Login or Register  to view this content.
    And I know I can probably do this through conditional formatting, but I don't to create a new rule for every circumstance that I'd need it for.

  5. #5
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,814

    Re: Function to adjust font properties

    Font face, size, and color are all properties of a cell -- not part of the cell's value. A UDF called from a spreadsheet cell like you are proposing cannot change the properties of a cell (even the cell it is called from).

    I'm not sure what to suggest. Conditional formatting is obviously out. You can apply limited formatting (colors) based on conditions using number format codes (see examples here: http://office.microsoft.com/en-us/ex...372.aspx?CTT=1 ). The most flexible will be to use a Sub procedure (probably associated with appropriate events like the change and calculate event).

  6. #6
    Registered User
    Join Date
    07-12-2014
    Location
    Chicago
    MS-Off Ver
    2013
    Posts
    67

    Re: Function to adjust font properties

    Ah, I see. If it's not meant to be, it's not meant to be. Thanks!

+ 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. need help changing data layout or adjust line chart properties to swap X/Y axis.
    By justinhampton81 in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 01-25-2013, 05:47 PM
  2. font size auto adjust
    By loner2003 in forum Excel General
    Replies: 0
    Last Post: 09-21-2010, 02:17 PM
  3. Adjust Color Properties
    By pilotwings64 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-27-2010, 01:36 PM
  4. [SOLVED] How do I adjust the font size in a Combo Box?
    By JessicaJ in forum Excel General
    Replies: 1
    Last Post: 10-25-2005, 01:05 PM
  5. [SOLVED] Adjust the font in Data Validation dropdown box
    By Bruce in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-08-2005, 04: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