Results 1 to 6 of 6
  1. #1
    5 Star Lounger
    Join Date
    Oct 2001
    Location
    San Bernardino, California, USA
    Posts
    734
    Thanks
    0
    Thanked 0 Times in 0 Posts

    REPT function (XP - 2002)

    I know how to use the REPT function to repeat a number/character "N" number of times but I would like to use this function to completely fill a cell regardless of the column width or point size of the font. What I am working on is trying to develop some Gantt charts (horizontal bar charts) showing project status, etc. Eventually, I want to use REPT to fill only a portion of a cell that will be determined by a formula comparing start time, elapsed time, etc.

    Am I on the wrong track or is there a way to have REPT fill an entire (or half, third) cell?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: REPT function (XP - 2002)

    Microsoft Project is of course much better suited for this kind of thing than Excel.

    Within Excel, you might use charts. See <!mskb=213915>Microsoft Knowledge Base Article 213915<!/mskb> and <!mskb=213447>Microsoft Knowledge Base Article 213447<!/mskb> and <!mskb=254008>Microsoft Knowledge Base Article 254008<!/mskb> (a downloadable add-in).

    See http://www.mrexcel.com/tip058.shtml for a different approach.

    Finally, to fill an entire cell with a character regardless of font and font size, set the horizontal alignment of the cell to Fill.

  3. #3
    5 Star Lounger
    Join Date
    Oct 2001
    Location
    San Bernardino, California, USA
    Posts
    734
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: REPT function (XP - 2002)

    Thanks Hans. I have seen the Mr. Excel example and that is close to what I want but not quite the same. His technique is based on using multiple columns (cells) to break the time period into dates. What I want to do is to use only one column (a wide one) to do the same thing. I think I can do this but I need to be able to "fill" the cell. I tried using CELL("Width") but that only works if I have the correct combination of repeated character and point size... in other words, it doesn't work for me.

    Regarding the MS add in, I really don't want to use a "chart" or "graph" but prefer to do this in the cells. I am cursed with always choosing the most difficult path.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: REPT function (XP - 2002)

    I think it will be quite difficult; you will probably need to write code involving the use of Windows API calls to determine the width of a character in pixels or twips, compare that to the column width in pixels, then calculate how many characters you need to fill a specified fraction of a cell. I don't know whether it is possible to wrap this all up into a custom function.

  5. #5
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: REPT function (XP - 2002)

    You also need to be aware that Excel is NOT WYSIWYG (What You See Is What You Get). So, you may spend a lot of time getting it to look just like you want on the screen, but if you then try to print it, the printout is not going to look anything like what was on the screen.
    Legare Coleman

  6. #6
    2 Star Lounger
    Join Date
    Sep 2002
    Location
    Birmingham, England
    Posts
    123
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: REPT function (XP - 2002)

    ...but it is wysiwyg is you use the print screen feature instead of printing it properly <grin>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •