![]() |
Total width of multiple columns
Is there a quick way of finding out the total width of several adjacent
columns? |
Total width of multiple columns
Hi,
I'd be intrigued to understand why you need this but here's one way. Call with =Col_Width() Select a single row of cells and tap F9 to make it re-calculate Function Col_Width() As Variant Dim C As Range Application.Volatile If Selection.Rows.Count 1 Then Exit Function For Each C In Selection Col_Width = Col_Width + C.ColumnWidth Next End Function -- Mike When competing hypotheses are otherwise equal, adopt the hypothesis that introduces the fewest assumptions while still sufficiently answering the question. "ni an" wrote: Is there a quick way of finding out the total width of several adjacent columns? |
Total width of multiple columns
Thanks Mike. I haven't tried this yet, but here's the reason I need it.
I have a number of spreadsheets that need to look good. One, for example, is a booking form for a holiday venue. The form is divided into sections which are outlined with borders in a grid format. To accommodate the different types of data in the various sections, the form is made up of several columns of varying widths, with different combinations of cells merged on different rows. Some of the sections are full page width and others are half width (two sections side by side). It's obviously going to look much better if both sides are of equal width, and I've built it like that, but sometimes I need to tweak column widths to make the data fit, and then I have to get both sides equal again. At the moment I check all the column widths and add them up, but I'm looking for a quicker and less tedious way. It would be great if I could merge all the columns on the left side of the page, and all the columns on the right, on a row outside the print area, and check the width of the merged cells whenever I needed to, but it doesn't work like that: it only gives you the unmerged width of the first column in each merged group. I'll try your formula later and let you know if I have any problems with it. |
All times are GMT +1. The time now is 11:59 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com