View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Gary Brown Gary Brown is offline
external usenet poster
 
Posts: 178
Default Cannot set ColumnWidth past column 148

This worked fine for me...
'-------------------------------------------------------------------------
Sub Macro1()
Dim col As Integer
Dim Startcolumn As Integer, Endcolumn As Integer

Startcolumn = 7
Endcolumn = 198
col = Startcolumn

For col = Startcolumn To Endcolumn - 1
ActiveSheet.Range(Cells(6, col), Cells(6, col)).ColumnWidth = 4
Next col

End Sub
'-------------------------------------------------------------------------

I'm wondering what your values for Startcolumn and Endcolumn are.
I can't think of any other issues that would cause this to fail.

--
HTH,
Gary Brown

If this post was helpful to you, please select ''YES'' at the bottom of the
post.



"MNTye" wrote:


cols.address = $ES$6

Further testing has also shown that it also fails if I do not set the
columnwidth for columns 7 through 148 and instead start the loop at
column 149!?!


--
MNTye
------------------------------------------------------------------------
MNTye's Profile:
http://www.excelforum.com/member.php...o&userid=36058
View this thread: http://www.excelforum.com/showthread...hreadid=558448