?
Solved

Set Multiple Widths to Different Columns in Excel

Posted on 2011-02-21
3
Medium Priority
?
695 Views
Last Modified: 2012-05-11
I want to set Multiple Widths in different columns in excel.

EX:
Column A- Width 10
Column B-Width 30
Column C- Width 50

I want to perform all the above actions simultaneously, at a click of command button using VBA
0
Comment
Question by:srikanthv2322
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 50

Accepted Solution

by:
Ingeborg Hawighorst (Microsoft MVP / EE MVE) earned 1000 total points
ID: 34948230
Hello,

Why not record a macro where you set the column widths. It will look something like this:

Sub Macro1()
    Columns("A:A").ColumnWidth = 10
    Columns("B:B").ColumnWidth = 30
    Columns("C:C").ColumnWidth = 50
End Sub

Open in new window


cheers, teylyn
0
 
LVL 20

Assisted Solution

by:Ardhendu Sarangi
Ardhendu Sarangi earned 1000 total points
ID: 34948239
Here's the code -


Sub Macro1()
    Columns("A:A").ColumnWidth = 10
        Columns("B:B").ColumnWidth = 30
    Columns("c:c").ColumnWidth = 50

    Application.WindowState = xlNormal
End Sub

Open in new window

0
 
LVL 20

Expert Comment

by:Ardhendu Sarangi
ID: 34948244
no points to me, teylyn  got it!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question