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

Columns("C:C").Resize(,iLastColumn3-2).ColumnWidth = 9.14

--
Regards,
Tom Ogilvy

"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