ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel Columns Autofix (https://www.excelbanter.com/excel-programming/346719-excel-columns-autofix.html)

WilliamMomo

Excel Columns Autofix
 
I have 2 cells ETWS.Cells(j, i) & ETWS.Cells(1, i).

I compare the text width of this two cells, if cells(j,i) is larger than the
(1,i) then the columns width of column i is equal to textwidth of cells(j,i).

How can i do that ?

Bob Phillips[_6_]

Excel Columns Autofix
 
With ETWS
If .Cells(j,i).ColumnWidth .Cells(1,i).ColumnWidth Then
.Cells(1,i).ColumnWidth = .Cells(j,i).ColumnWidth
End If
End With

--

HTH

RP
(remove nothere from the email address if mailing direct)


"WilliamMomo" wrote in message
...
I have 2 cells ETWS.Cells(j, i) & ETWS.Cells(1, i).

I compare the text width of this two cells, if cells(j,i) is larger than

the
(1,i) then the columns width of column i is equal to textwidth of

cells(j,i).

How can i do that ?




WilliamMomo

Excel Columns Autofix
 
Although its not work, also said thx.

"Bob Phillips" wrote:

With ETWS
If .Cells(j,i).ColumnWidth .Cells(1,i).ColumnWidth Then
.Cells(1,i).ColumnWidth = .Cells(j,i).ColumnWidth
End If
End With

--

HTH

RP
(remove nothere from the email address if mailing direct)


"WilliamMomo" wrote in message
...
I have 2 cells ETWS.Cells(j, i) & ETWS.Cells(1, i).

I compare the text width of this two cells, if cells(j,i) is larger than

the
(1,i) then the columns width of column i is equal to textwidth of

cells(j,i).

How can i do that ?





Mike Fogleman

Excel Columns Autofix
 
Perhaps you want to compare the number of characters, and if (j,i) has more
then autofit the column.

With ETWS
If Len(.Cells(j, i)) Len(.Cells(1, i)) Then
Columns(i).AutoFit
End If
End With

Mike F
"WilliamMomo" wrote in message
...
Although its not work, also said thx.

"Bob Phillips" wrote:

With ETWS
If .Cells(j,i).ColumnWidth .Cells(1,i).ColumnWidth Then
.Cells(1,i).ColumnWidth = .Cells(j,i).ColumnWidth
End If
End With

--

HTH

RP
(remove nothere from the email address if mailing direct)


"WilliamMomo" wrote in message
...
I have 2 cells ETWS.Cells(j, i) & ETWS.Cells(1, i).

I compare the text width of this two cells, if cells(j,i) is larger
than

the
(1,i) then the columns width of column i is equal to textwidth of

cells(j,i).

How can i do that ?







WilliamMomo

Excel Columns Autofix
 
thx alot for help i solve the problem la.

"Mike Fogleman" wrote:

Perhaps you want to compare the number of characters, and if (j,i) has more
then autofit the column.

With ETWS
If Len(.Cells(j, i)) Len(.Cells(1, i)) Then
Columns(i).AutoFit
End If
End With

Mike F
"WilliamMomo" wrote in message
...
Although its not work, also said thx.

"Bob Phillips" wrote:

With ETWS
If .Cells(j,i).ColumnWidth .Cells(1,i).ColumnWidth Then
.Cells(1,i).ColumnWidth = .Cells(j,i).ColumnWidth
End If
End With

--

HTH

RP
(remove nothere from the email address if mailing direct)


"WilliamMomo" wrote in message
...
I have 2 cells ETWS.Cells(j, i) & ETWS.Cells(1, i).

I compare the text width of this two cells, if cells(j,i) is larger
than
the
(1,i) then the columns width of column i is equal to textwidth of
cells(j,i).

How can i do that ?








All times are GMT +1. The time now is 11:58 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com