View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default columncount and range?

Just a heads up:
Columns doesn't accept two integer arguments to the best of my knowledge.


Maybe
Range(cells(1,3),cells(1,iLastcolumn3)).Entirecolu mn.ColumnWidth = 9.14

--
Regards,
Tom Ogilvy


"Die_Another_Day" wrote:

Columns should work with integers as well try:
Columns(3,iLastColumn3).ColumnWidth = 9.14

Die_Another_Day
leonidas wrote:
Hi,

I have a some columns from which the columnwidth should be changed. I
have written a piece of code to do that, but I get an error when using
it. I found out that iLastColumn3 gives the outcome "20" instead of
"T".
How should I change the code to get it working? Thanks in advance!


Code:
--------------------
iLastRow3 = Cells(Rows.Count, "B").End(xlUp).Row
iLastColumn3 = Cells(iLastRow3, Columns.Count).End(xlToLeft).Column
Columns("B:B").ColumnWidth = 10
Columns("C", iLastColumn3).ColumnWidth = 9.14
--------------------


--
leonidas
------------------------------------------------------------------------
leonidas's Profile: http://www.excelforum.com/member.php...o&userid=35375
View this thread: http://www.excelforum.com/showthread...hreadid=566638