Results 1 to 3 of 3

Thread: Resizing Column & Row * RESOLVED *

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2001
    Location
    Montréal, Québec
    Posts
    195

    Resizing Column & Row * RESOLVED *

    I want to resize sheets columns and rows when I open my file. (On startUp of the .xls)

    I have only the first sheets that is not like the others (in column and rows size)

    How do I do this?


    I would like to have something like that if possible:
    (cause I have a lot of sheet in my .xls)

    Dim form as sheet
    for each form in ?
    if (form.name <> "First Form") then
    form.row(6).pixelwidth = 50
    form.column(7 or "E").pixelwidth = 150
    end if
    next sheet

    ?

    thks
    Last edited by Megistal; Jul 19th, 2003 at 09:32 AM.

  2. #2
    New Member
    Join Date
    Jul 2003
    Location
    New York
    Posts
    8
    Hi there

    Try this simple example. I think it should work for any workbook if you modify the code a bit. Instead of using the Index of the workbook, in the line For Each shtWorkSheet In Workbooks(1).Worksheets, you can use the active workbook, or a workbook by name, or what have you.

    Also you may change the 25 in the line .Columns.ColumnWidth = 25 to what ever width you want.

    Sub ChangeColumnWidthInAllWorksheets()
    Dim shtWorkSheet As Worksheet '/A Counter for all the Worksheets.

    '/Loop using each of the worksheets in the workbook.
    For Each shtWorkSheet In Workbooks(1).Worksheets
    '/With the object which is the worksheets
    With shtWorkSheet
    '/And the worksheet has columns so with these, change the widht to 25
    .Columns.ColumnWidth = 25
    End With
    '/Loop to the Next worksheet.
    Next shtWorkSheet

    '/Beep when done.
    Beep
    End Sub

    Let me know if you need any help.

    Dr. Technology

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 2001
    Location
    Montréal, Québec
    Posts
    195
    Great

    Exactly what I was hoping!

    It work great

    Thks!

Posting Permissions

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



Click Here to Expand Forum to Full Width