View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default find largest column width and ...

Try some code like

Sub AAA()
Dim MaxWidth As Double
Dim R As Range
Dim RR As Range

Set RR = Range("A1:K10")
For Each R In RR
If R.ColumnWidth MaxWidth Then
MaxWidth = R.ColumnWidth
End If
Next R
RR.EntireColumn.ColumnWidth = MaxWidth
End Sub

Cordially,
Chip Pearson
Microsoft MVP 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com
[email on web site]



On Sat, 08 May 2010 06:47:51 -0700, S S wrote:

Hello

i would like to find the largest column width in a range e.g. "A1:A20" and then set all the columns of this range to this largest width. how can i do that?

Thanx.


Submitted via EggHeadCafe - Software Developer Portal of Choice
Crypto Obfuscator for .NET - Product Review
http://www.eggheadcafe.com/tutorials/aspnet/bf15c41b-6510-403e-9af8-f5fd987fafb1/crypto-obfuscator-for-ne.aspx