Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Set Multiple Widths to Different Columns in Excel

Posted on 2011-02-21
3
Medium Priority
?
702 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

Independent Software Vendors: 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

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

604 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