+ Reply to Thread
Results 1 to 6 of 6

VBA macro to autofit each column and row to x number of pixels

  1. #1
    Registered User
    Join Date
    08-11-2009
    Location
    Gilbert, Arizona, USA
    MS-Off Ver
    Excel 2003
    Posts
    82

    VBA macro to autofit each column and row to x number of pixels

    Hi all,
    I'm trying to create a grid that I can print and then draw on freehand. How do I loop each column and row so I get perfect squares, say, at 10 pixels?

    Its been a while (years) since I have done any macro programming and its not coming back as quickly as I had hoped.

    thanks for your help!
    Kelly

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: VBA macro to autofit each column and row to x number of pixels

    why not just download this
    http://office.microsoft.com/en-us/te...010193274.aspx
    or do this
    http://www.techrepublic.com/blog/mso...aph-paper/2751
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Registered User
    Join Date
    08-11-2009
    Location
    Gilbert, Arizona, USA
    MS-Off Ver
    Excel 2003
    Posts
    82

    Re: VBA macro to autofit each column and row to x number of pixels

    I'm looking to do this in VBA. There are a couple more steps, that was just the first one.
    1. I am using Excel 2003 on a Mac.
    2. I want to draw up different parts with different measurments so I will be changing the cell sizes frequently
    3. Would like to be able to say "this page will be 3ft by 4ft" and automatically adjust each cell to be a 1" increment
    4. Label the tickmarks
    5. Set the print area

    I know I can do this in a macro but I haven't programmed since 2009. I'm hoping it will come back to me as I start working with VBA again.

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: VBA macro to autofit each column and row to x number of pixels

    Hi curbster,

    You could alter this code, which I've been using to make grids:

    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  5. #5
    Registered User
    Join Date
    08-11-2009
    Location
    Gilbert, Arizona, USA
    MS-Off Ver
    Excel 2003
    Posts
    82

    Re: VBA macro to autofit each column and row to x number of pixels

    I'm not able to make that work. Excel doesn't even recognize a macro exists. Not sure what I'm doing wrong.

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: VBA macro to autofit each column and row to x number of pixels

    Hi curbster,

    You need to set your security in Excel to medium if you haven't already done so.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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