+ Reply to Thread
Results 1 to 4 of 4

Formatting the zoom based on max number of characters in a cell

  1. #1
    Registered User
    Join Date
    06-19-2007
    Posts
    7

    Formatting the zoom based on max number of characters in a cell

    Is there a way to change the zoom of the page when text within any cell on that sheet passes a certain number of characters?
    i.e. if there are more than 92 characters but less than 128, change zoom (in Page setup) to 80%
    ...or perhaps more importantly:
    How do you locate the maximum amount of characters in any cell on a sheet within a macro?

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Poopdish,

    The best method is to examine the cell's length at the time of input. The cells could be examined whenever you decide to run the macro. However, checking all the used cells on a worksheet, especially a large sheet, could be quite slow.

    This example examines the cell's length at input.
    Please Login or Register  to view this content.
    To Install the Macro:

    1) Copy the Macro using CTRL+C.
    2) Right Click on the Sheet's name tab the macro will be run on.
    3) Click "View Code" from the pop up menu.
    4) Paste the macro using CTRL+V.
    5) Save the macro using CTRL+S

    Sincerely,
    Leith Ross

  3. #3
    Registered User
    Join Date
    06-19-2007
    Posts
    7
    Thanks for your help, this helped me get to what I was looking for. Just for future reference, what does it mean when you declare a variable "As Long"?

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Poopdish,

    In VBA there are 2 types of whole numbers. The Integer type which is 16 bits (2 bytes long) and the Long type which is 32 bits (4 bytes long). Older versions of Windows used 16 bit words. The later versions 95 and up use 32 bit words. Vist (Windows 2007) use 32 bit and 64 bit words.

    Sincerely,
    Leith Ross

+ 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