ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   autofit problem (https://www.excelbanter.com/excel-programming/352143-autofit-problem.html)

Gary Keramidas

autofit problem
 
when i use autofit, in code or just clicking the column divider, it doesn't
always autofit all of the columns.

using this code
..Columns("A:Q").AutoFit

i sometimes have one column that displays some ###'s, in this case it was column
D. the column has actual numbers in it, not a formula.

and ideas?

--


Gary




Dave Peterson

autofit problem
 
What happens if you widen the columns as far as you can, then autofit?

With ActiveSheet
With .Columns("A:Q")
.ColumnWidth = 255
.AutoFit
End With
End With

Maybe it'll help.



Gary Keramidas wrote:

when i use autofit, in code or just clicking the column divider, it doesn't
always autofit all of the columns.

using this code
.Columns("A:Q").AutoFit

i sometimes have one column that displays some ###'s, in this case it was column
D. the column has actual numbers in it, not a formula.

and ideas?

--

Gary


--

Dave Peterson

Gary Keramidas

autofit problem
 
no luck with that, either, i have tried 20 in the past, but never 255.

--


Gary


"Dave Peterson" wrote in message
...
What happens if you widen the columns as far as you can, then autofit?

With ActiveSheet
With .Columns("A:Q")
.ColumnWidth = 255
.AutoFit
End With
End With

Maybe it'll help.



Gary Keramidas wrote:

when i use autofit, in code or just clicking the column divider, it doesn't
always autofit all of the columns.

using this code
.Columns("A:Q").AutoFit

i sometimes have one column that displays some ###'s, in this case it was
column
D. the column has actual numbers in it, not a formula.

and ideas?

--

Gary


--

Dave Peterson




Dave Peterson

autofit problem
 
Does that mean you tried 255 and it failed?

If you know which columns need to be widened, you could always just add a little
to that columnwidth after autofitting.

with .columns("d")
.autofit
.columnwidth = .columnwidth + 2 'as small as you need
end with

Gary Keramidas wrote:

no luck with that, either, i have tried 20 in the past, but never 255.

--

Gary

"Dave Peterson" wrote in message
...
What happens if you widen the columns as far as you can, then autofit?

With ActiveSheet
With .Columns("A:Q")
.ColumnWidth = 255
.AutoFit
End With
End With

Maybe it'll help.



Gary Keramidas wrote:

when i use autofit, in code or just clicking the column divider, it doesn't
always autofit all of the columns.

using this code
.Columns("A:Q").AutoFit

i sometimes have one column that displays some ###'s, in this case it was
column
D. the column has actual numbers in it, not a formula.

and ideas?

--

Gary


--

Dave Peterson


--

Dave Peterson

Gary Keramidas

autofit problem
 
yes, 255 failed, it seems to autofitting on the column header in row 1, not any
of the values below it. is this normal?

--


Gary


"Dave Peterson" wrote in message
...
Does that mean you tried 255 and it failed?

If you know which columns need to be widened, you could always just add a
little
to that columnwidth after autofitting.

with .columns("d")
.autofit
.columnwidth = .columnwidth + 2 'as small as you need
end with

Gary Keramidas wrote:

no luck with that, either, i have tried 20 in the past, but never 255.

--

Gary

"Dave Peterson" wrote in message
...
What happens if you widen the columns as far as you can, then autofit?

With ActiveSheet
With .Columns("A:Q")
.ColumnWidth = 255
.AutoFit
End With
End With

Maybe it'll help.



Gary Keramidas wrote:

when i use autofit, in code or just clicking the column divider, it
doesn't
always autofit all of the columns.

using this code
.Columns("A:Q").AutoFit

i sometimes have one column that displays some ###'s, in this case it was
column
D. the column has actual numbers in it, not a formula.

and ideas?

--

Gary

--

Dave Peterson


--

Dave Peterson




Dave Peterson

autofit problem
 
Not that I've seen.

Gary Keramidas wrote:

yes, 255 failed, it seems to autofitting on the column header in row 1, not any
of the values below it. is this normal?

--

Gary

"Dave Peterson" wrote in message
...
Does that mean you tried 255 and it failed?

If you know which columns need to be widened, you could always just add a
little
to that columnwidth after autofitting.

with .columns("d")
.autofit
.columnwidth = .columnwidth + 2 'as small as you need
end with

Gary Keramidas wrote:

no luck with that, either, i have tried 20 in the past, but never 255.

--

Gary

"Dave Peterson" wrote in message
...
What happens if you widen the columns as far as you can, then autofit?

With ActiveSheet
With .Columns("A:Q")
.ColumnWidth = 255
.AutoFit
End With
End With

Maybe it'll help.



Gary Keramidas wrote:

when i use autofit, in code or just clicking the column divider, it
doesn't
always autofit all of the columns.

using this code
.Columns("A:Q").AutoFit

i sometimes have one column that displays some ###'s, in this case it was
column
D. the column has actual numbers in it, not a formula.

and ideas?

--

Gary

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson

Jim Cone

autofit problem
 
Dave and Gary,

I was hoping you two would come up with a reason for the non-autofit.
I have seen this occur for no apparent reason and in critical? code have
resorted to manually setting columns widths...

For x = 1 to 10
Worksheets(2).Columns(x).ColumnWidth = _
Worksheets(1).Columns(x).ColumnWidth
Next

Regards,
Jim Cone
San Francisco, USA


"Dave Peterson" wrote in message ...
Not that I've seen.

Gary Keramidas wrote:

yes, 255 failed, it seems to autofitting on the column header in row 1, not any
of the values below it. is this normal?
Gary



Dave Peterson

autofit problem
 
And depending on the version of excel, you could
copy|paste special|columnwidths.

Maybe searching for #### would be a good way to go, too. Then widen that column
a bit, then a bit more, then...

(As long as there are no negative date/times and no real ###'s in the cell!)

I think I saw one of those routines in the eee newsletter on John Walkenbach's
site:
http://www.j-walk.com/ss/excel/eee/

But I didn't see it in a quick glance.

Jim Cone wrote:

Dave and Gary,

I was hoping you two would come up with a reason for the non-autofit.
I have seen this occur for no apparent reason and in critical? code have
resorted to manually setting columns widths...

For x = 1 to 10
Worksheets(2).Columns(x).ColumnWidth = _
Worksheets(1).Columns(x).ColumnWidth
Next

Regards,
Jim Cone
San Francisco, USA

"Dave Peterson" wrote in message ...
Not that I've seen.

Gary Keramidas wrote:

yes, 255 failed, it seems to autofitting on the column header in row 1, not any
of the values below it. is this normal?
Gary


--

Dave Peterson

Jim Cone

autofit problem
 
Dave,

Good memory.
I printed out the entire EEE letter several years ago.
Just took a look, it is in Chapter 9 with a short piece of code by John Green...
...
If IsNumeric(rng.Value) and Left(rng.Text,1) = "#" then
...

Regards,
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"Dave Peterson" wrote in message ...
And depending on the version of excel, you could
copy|paste special|columnwidths.

Maybe searching for #### would be a good way to go, too. Then widen that column
a bit, then a bit more, then...

(As long as there are no negative date/times and no real ###'s in the cell!)

I think I saw one of those routines in the eee newsletter on John Walkenbach's
site:
http://www.j-walk.com/ss/excel/eee/

But I didn't see it in a quick glance.

Jim Cone wrote:

Dave and Gary,

I was hoping you two would come up with a reason for the non-autofit.
I have seen this occur for no apparent reason and in critical? code have
resorted to manually setting columns widths...

For x = 1 to 10
Worksheets(2).Columns(x).ColumnWidth = _
Worksheets(1).Columns(x).ColumnWidth
Next

Regards,
Jim Cone
San Francisco, USA

"Dave Peterson" wrote in message ...
Not that I've seen.

Gary Keramidas wrote:

yes, 255 failed, it seems to autofitting on the column header in row 1, not any
of the values below it. is this normal?
Gary


--

Dave Peterson

Dave Peterson

autofit problem
 
That's the one!

I used the search (for #### and for width and for columnwidth), but never got a
hit. Hmmm.



Jim Cone wrote:

Dave,

Good memory.
I printed out the entire EEE letter several years ago.
Just took a look, it is in Chapter 9 with a short piece of code by John Green...
...
If IsNumeric(rng.Value) and Left(rng.Text,1) = "#" then
...

Regards,
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware

"Dave Peterson" wrote in message ...
And depending on the version of excel, you could
copy|paste special|columnwidths.

Maybe searching for #### would be a good way to go, too. Then widen that column
a bit, then a bit more, then...

(As long as there are no negative date/times and no real ###'s in the cell!)

I think I saw one of those routines in the eee newsletter on John Walkenbach's
site:
http://www.j-walk.com/ss/excel/eee/

But I didn't see it in a quick glance.

Jim Cone wrote:

Dave and Gary,

I was hoping you two would come up with a reason for the non-autofit.
I have seen this occur for no apparent reason and in critical? code have
resorted to manually setting columns widths...

For x = 1 to 10
Worksheets(2).Columns(x).ColumnWidth = _
Worksheets(1).Columns(x).ColumnWidth
Next

Regards,
Jim Cone
San Francisco, USA

"Dave Peterson" wrote in message ...
Not that I've seen.

Gary Keramidas wrote:

yes, 255 failed, it seems to autofitting on the column header in row 1, not any
of the values below it. is this normal?
Gary


--

Dave Peterson


--

Dave Peterson

excelent

autofit problem
 
looks like u substarct 2 dates and result is negative,- gives a lot of #####


"Dave Peterson" skrev:

That's the one!

I used the search (for #### and for width and for columnwidth), but never got a
hit. Hmmm.



Jim Cone wrote:

Dave,

Good memory.
I printed out the entire EEE letter several years ago.
Just took a look, it is in Chapter 9 with a short piece of code by John Green...
...
If IsNumeric(rng.Value) and Left(rng.Text,1) = "#" then
...

Regards,
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware

"Dave Peterson" wrote in message ...
And depending on the version of excel, you could
copy|paste special|columnwidths.

Maybe searching for #### would be a good way to go, too. Then widen that column
a bit, then a bit more, then...

(As long as there are no negative date/times and no real ###'s in the cell!)

I think I saw one of those routines in the eee newsletter on John Walkenbach's
site:
http://www.j-walk.com/ss/excel/eee/

But I didn't see it in a quick glance.

Jim Cone wrote:

Dave and Gary,

I was hoping you two would come up with a reason for the non-autofit.
I have seen this occur for no apparent reason and in critical? code have
resorted to manually setting columns widths...

For x = 1 to 10
Worksheets(2).Columns(x).ColumnWidth = _
Worksheets(1).Columns(x).ColumnWidth
Next

Regards,
Jim Cone
San Francisco, USA

"Dave Peterson" wrote in message ...
Not that I've seen.

Gary Keramidas wrote:

yes, 255 failed, it seems to autofitting on the column header in row 1, not any
of the values below it. is this normal?
Gary


--

Dave Peterson


--

Dave Peterson



All times are GMT +1. The time now is 06:24 PM.

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