Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Set Column Width Based On Total Width Of Other Columns

I need help setting up the following Column Width macro in Excel:

1. The "width" for Columns A, B, C, D should total 40.
2. Columns B, C, D have been "autofit" based on the data entered.
3. How would I set Column A "width" for all columns to still equal 40.

For example:

The new values are as follows:
Column B = 13
Column C = 10
Column D = 5

How would I set Column A "width" to 40 - (13,10,5)
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default Set Column Width Based On Total Width Of Other Columns

Hi,

Something like this should work:

Sub SetWidthOfColD()
Dim sngWidth As Single

With Sheets("mySheet")
sngWidth = .Columns("A").ColumnWidth + _
.Columns("B").ColumnWidth + _
.Columns("C").ColumnWidth

If (sngWidth < 40) Then
.Columns("D").ColumnWidth = 40 - sngWidth
End If
End With
End Sub

--
Regards,

Jake Marx
www.longhead.com


[please keep replies in the newsgroup - email address unmonitored]

rayneraingoaway wrote:
I need help setting up the following Column Width macro in Excel:

1. The "width" for Columns A, B, C, D should total 40.
2. Columns B, C, D have been "autofit" based on the data entered.
3. How would I set Column A "width" for all columns to still equal 40.

For example:

The new values are as follows:
Column B = 13
Column C = 10
Column D = 5

How would I set Column A "width" to 40 - (13,10,5)



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Total width of multiple columns ni an Excel Discussion (Misc queries) 2 February 24th 10 12:07 PM
Total width of selected columns? sarah Excel Discussion (Misc queries) 2 February 10th 09 03:16 PM
Total width of selected columns? sarah Excel Discussion (Misc queries) 2 February 10th 09 03:14 PM
Total width of several columns. Basher Bates Excel Worksheet Functions 2 April 17th 06 12:38 PM


All times are GMT +1. The time now is 10:12 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"