Solved

Set Multiple Widths to Different Columns in Excel

Posted on 2011-02-21
3
647 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
  • 2
3 Comments
 
LVL 50

Accepted Solution

by:
teylyn 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:pari123
pari123 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:pari123
ID: 34948244
no points to me, teylyn  got it!
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

757 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now