merrymonk has asked for the wisdom of the Perl Monks concerning the following question:

I want to calculate the widths of columns of an Excel spreadsheet by:,
1. Setting the width of all the columns I want to use to a small value;
2. Calculating the width for each set of data in each cell and then using this width if it is bigger than the current value.
I am using
$sheet -> Range("A1:AZ1000") -> {ColumnWidth} = 4;
to set the value. This and the width calculation work fine.
However, when I open the spreadsheet it opens with Column BA at the left hand side of the screen.
What do I have to do so that it opens with cell A at the left hand side of the screen?

Replies are listed 'Best First'.
Re: Opening spreadsheet at correct column
by roboticus (Chancellor) on May 10, 2010 at 13:59 UTC

    merrymonk:

    I believe you can make the spreadsheet open at column A by selecting one of the leftmost cells before closing the worksheet, something like:

    $worksheet1->set_selection(0,0); # Select A1

    ...roboticus

      Thanks - that worked a treat!!
Re: Opening spreadsheet at correct column
by ww (Archbishop) on May 10, 2010 at 12:18 UTC
    Can you show us a small, self-contained bit of code that acts as you describe? With only a single line of code (and that, not formatted as code), it's impossible to guess what you're doing wrong.

    And, please, read Markup in the Monastery. The subset of html used here doesn't recognize "</br>" as markup. As the page where you entered this says, "Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!"

      Sorry about the appalling use of tags.
      I did try to create a simple example but failed!!
      However, roboticus's suggestion worked.

        "Sorry"? But not sorry enough to correct it... or even to do it correctly in your reply?

        - - for a pilgrim who's been around long enough to know better.