Solved

Set Multiple Widths to Different Columns in Excel

Posted on 2011-02-21
3
686 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 earned 250 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 250 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

This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

696 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