+ Reply to Thread
Results 1 to 5 of 5

Setting columnwidths

  1. #1
    Jason Zischke
    Guest

    Setting columnwidths

    Hi all,

    I've got one that has stumped me, I'm tring to set my column widths so that
    they fit to the window size however when using different screen sizes and
    different pixel sizes I can't get it working in all cases. I am currently
    using the function application.width to grab the window size, if anyone can
    help me that would be greatly appreciated.

    Jason Zischke

  2. #2
    NickHK
    Guest

    Re: Setting columnwidths

    Jason,
    Depending what you are trying to achieve, Window.UsableWidth (in points) may
    be what you are after.
    Then .Column.Width (in points) for each column that you wish to adjust.

    NickHK

    "Jason Zischke" <[email protected]> wrote in message
    news:[email protected]...
    > Hi all,
    >
    > I've got one that has stumped me, I'm tring to set my column widths so

    that
    > they fit to the window size however when using different screen sizes and
    > different pixel sizes I can't get it working in all cases. I am currently
    > using the function application.width to grab the window size, if anyone

    can
    > help me that would be greatly appreciated.
    >
    > Jason Zischke




  3. #3
    Jason Zischke
    Guest

    Re: Setting columnwidths

    Dear NickHK

    That sounds about that might work but how do do the column width in points ?

    Jason

    "NickHK" wrote:

    > Jason,
    > Depending what you are trying to achieve, Window.UsableWidth (in points) may
    > be what you are after.
    > Then .Column.Width (in points) for each column that you wish to adjust.
    >
    > NickHK
    >
    > "Jason Zischke" <[email protected]> wrote in message
    > news:[email protected]...
    > > Hi all,
    > >
    > > I've got one that has stumped me, I'm tring to set my column widths so

    > that
    > > they fit to the window size however when using different screen sizes and
    > > different pixel sizes I can't get it working in all cases. I am currently
    > > using the function application.width to grab the window size, if anyone

    > can
    > > help me that would be greatly appreciated.
    > >
    > > Jason Zischke

    >
    >
    >


  4. #4
    NickHK
    Guest

    Re: Setting columnwidths

    Jason,
    Something like this, converting from points to the units of ColumnWidth.
    <From Help>
    One unit of column width is equal to the width of one character in the
    Normal style
    </From Help>


    Private Sub CommandButton1_Click()
    Dim ColWidth As Single
    Dim Factor As Single
    Dim i As Long
    'The range of columns you want to fit in the window
    With Range("rngColumns")
    ColWidth = ActiveWindow.UsableWidth / .Columns.Count
    Factor = .Columns(1).Width / .Columns(1).ColumnWidth
    For i = 1 To .Columns.Count
    .Columns(i).ColumnWidth = ColWidth / Factor
    Next
    End With

    End Sub

    NickHK

    "Jason Zischke" <[email protected]> wrote in message
    news:[email protected]...
    > Dear NickHK
    >
    > That sounds about that might work but how do do the column width in points

    ?
    >
    > Jason
    >
    > "NickHK" wrote:
    >
    > > Jason,
    > > Depending what you are trying to achieve, Window.UsableWidth (in points)

    may
    > > be what you are after.
    > > Then .Column.Width (in points) for each column that you wish to adjust.
    > >
    > > NickHK
    > >
    > > "Jason Zischke" <[email protected]> wrote in

    message
    > > news:[email protected]...
    > > > Hi all,
    > > >
    > > > I've got one that has stumped me, I'm tring to set my column widths so

    > > that
    > > > they fit to the window size however when using different screen sizes

    and
    > > > different pixel sizes I can't get it working in all cases. I am

    currently
    > > > using the function application.width to grab the window size, if

    anyone
    > > can
    > > > help me that would be greatly appreciated.
    > > >
    > > > Jason Zischke

    > >
    > >
    > >




  5. #5
    Jason Zischke
    Guest

    Re: Setting columnwidths

    NickHK

    Thanks, that is just what I was looking for.

    Jason

    "NickHK" wrote:

    > Jason,
    > Something like this, converting from points to the units of ColumnWidth.
    > <From Help>
    > One unit of column width is equal to the width of one character in the
    > Normal style
    > </From Help>
    >
    >
    > Private Sub CommandButton1_Click()
    > Dim ColWidth As Single
    > Dim Factor As Single
    > Dim i As Long
    > 'The range of columns you want to fit in the window
    > With Range("rngColumns")
    > ColWidth = ActiveWindow.UsableWidth / .Columns.Count
    > Factor = .Columns(1).Width / .Columns(1).ColumnWidth
    > For i = 1 To .Columns.Count
    > .Columns(i).ColumnWidth = ColWidth / Factor
    > Next
    > End With
    >
    > End Sub
    >
    > NickHK
    >
    > "Jason Zischke" <[email protected]> wrote in message
    > news:[email protected]...
    > > Dear NickHK
    > >
    > > That sounds about that might work but how do do the column width in points

    > ?
    > >
    > > Jason
    > >
    > > "NickHK" wrote:
    > >
    > > > Jason,
    > > > Depending what you are trying to achieve, Window.UsableWidth (in points)

    > may
    > > > be what you are after.
    > > > Then .Column.Width (in points) for each column that you wish to adjust.
    > > >
    > > > NickHK
    > > >
    > > > "Jason Zischke" <[email protected]> wrote in

    > message
    > > > news:[email protected]...
    > > > > Hi all,
    > > > >
    > > > > I've got one that has stumped me, I'm tring to set my column widths so
    > > > that
    > > > > they fit to the window size however when using different screen sizes

    > and
    > > > > different pixel sizes I can't get it working in all cases. I am

    > currently
    > > > > using the function application.width to grab the window size, if

    > anyone
    > > > can
    > > > > help me that would be greatly appreciated.
    > > > >
    > > > > Jason Zischke
    > > >
    > > >
    > > >

    >
    >
    >


+ 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