+ Reply to Thread
Results 1 to 5 of 5

Change font format (style, size, etc.) of all cells in all worksheets

  1. #1
    Registered User
    Join Date
    04-20-2017
    Location
    Amsterdam
    MS-Off Ver
    2016
    Posts
    2

    Change font format (style, size, etc.) of all cells in all worksheets

    Hello,

    I want to write a macro which enables the user to change the font properties of the entire workbook with one click.

    I wrote this code, which only works partly:
    Please Login or Register  to view this content.
    I can change the font size with this code, but not the Name. When I run the macro, for a millisecond the font in my workbook changes, then goes back to the original font. I restarted Excel, but that did not change anything.

    Is there anything wrong with my code or do I need to look for a solution elsewhere? (I am new to VBA.)

    Thanks in advance!

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

    Re: Change font format (style, size, etc.) of all cells in all worksheets

    Welcome to the forum
    Your code looks ok

    But I noticed that I had a problem with a couple of fonts when I experimented
    I found that if I put the name in a variable or in a cell and referred to that ,then it worked
    It makes no sense, but there we are!

    So try this:

    Please Login or Register  to view this content.
    Click *Add Reputation to thank those who helped you. Ask if anything is not clear

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

    Re: Change font format (style, size, etc.) of all cells in all worksheets

    What you are doing is not the best approach

    With a clean workbook, this line
    Please Login or Register  to view this content.
    changes the default normal style without formatting ALL the cells in ALL worksheets

    The above does not work if the cells have already had their font names formatted

  4. #4
    Registered User
    Join Date
    04-20-2017
    Location
    Amsterdam
    MS-Off Ver
    2016
    Posts
    2

    Re: Change font format (style, size, etc.) of all cells in all worksheets

    Thanks for taking a look!

    I tried your suggested approach, unfortunately it still does not work. :/

    P.S. I am indeed trying to adjust the formatting for a workbook which already has content, so I guess I have to take the second-to-best approach

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

    Re: Change font format (style, size, etc.) of all cells in all worksheets

    Like I said, I encountered a problem that I cannot explain with certain font names.

    another method that worked every time was to put the font name in a cell, and using the above code (with the font name Arial in cell A1)

    replace:
    Please Login or Register  to view this content.
    with:
    Please Login or Register  to view this content.
    It makes no sense that either of the above give a different result to your original code:
    Please Login or Register  to view this content.
    If you are still having problems, I suggest you try a totally different font - and then it proves that your code is not the problem

    eg I had no trouble whatsoever with "Lucida Handwriting"
    - it worked in your original code and in both of my 2 "minor" variations

+ 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. [SOLVED] Format Spreadsheet - borders, font size/style, split text to columns
    By lacke81c in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-30-2015, 02:34 PM
  2. Replies: 2
    Last Post: 05-13-2014, 08:51 AM
  3. Replies: 1
    Last Post: 11-08-2013, 04:16 AM
  4. How to using comma style without change font & font size
    By rameshtupe in forum Excel General
    Replies: 1
    Last Post: 07-11-2013, 01:19 PM
  5. [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
  6. Change Font & Size in All Worksheets
    By BonesJones in forum Excel General
    Replies: 9
    Last Post: 08-12-2012, 02:17 AM
  7. want format cells alignment not format cells font style
    By Jeannie Bean in forum Excel General
    Replies: 2
    Last Post: 02-10-2006, 05:35 AM

Tags for this Thread

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