Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Cannot set ColumnWidth past column 148


I have a spreadsheet with 198 columns built by VBA procedures. Columns 7
thru 198 contain monthly data, i.e., columns 7 thru 18 contain data for
the months of year 1, columns 19 thru 30 contain data for the months of
year 2, ...., columns 187 thru 198 contain data for the months of year
16.

I need to set the ColumnWidth for columns 7 thru 198 to 4. I've never
had a problem setting ColumnWidth before as I do this (among other
things) for a living for the past 8 months. I've tried multiple
methods, i.e., Range, Range-by-Range, Column-by-Column, and each one
fails at column 149.


Code:
--------------------
Dim col As Integer
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Cannot set ColumnWidth past column 148

why so complex? Can't you just do

Range(Cells(1, 7), Cells(1, 198)).ColumnWidth = 4

Are some of the cells locked and protected?

"MNTye" wrote:


I have a spreadsheet with 198 columns built by VBA procedures. Columns 7
thru 198 contain monthly data, i.e., columns 7 thru 18 contain data for
the months of year 1, columns 19 thru 30 contain data for the months of
year 2, ...., columns 187 thru 198 contain data for the months of year
16.

I need to set the ColumnWidth for columns 7 thru 198 to 4. I've never
had a problem setting ColumnWidth before as I do this (among other
things) for a living for the past 8 months. I've tried multiple
methods, i.e., Range, Range-by-Range, Column-by-Column, and each one
fails at column 149.


Code:
--------------------
Dim col As Integer
.
.
.
Startcolumn = Range(Replace(Replace(Replace(Replace(ActiveSheet. Name, ")", "_"), "(", "_"), " ", "_"), "-", "_") + "endheader").Column
Endcolumn = Range(Replace(Replace(Replace(Replace(ActiveSheet. Name, ")", "_"), "(", "_"), " ", "_"), "-", "_") + "endheader2").Column
col = Startcolumn
While col < Endcolumn
For Each cols In ActiveSheet.Range(Cells(6, col), Cells(6, col))
cols.ColumnWidth = 4
Next cols
col = col + 1
Wend
--------------------


I appreciate any help you can give. Thanks!


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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Cannot set ColumnWidth past column 148


No, the cells are neither locked nor protected. I tried setting th
columnwidth for the entire range as my first attempt. That failed so
switched to column by column to see where the problem is. The odd thin
is that even if I start at any column greater than 148, it fails. So i
doesn't appear to be a limit on how many columns can have thei
columnwidth set

--
MNTy
-----------------------------------------------------------------------
MNTye's Profile: http://www.excelforum.com/member.php...fo&userid=3605
View this thread: http://www.excelforum.com/showthread.php?threadid=55844

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
copy & past row to column James Excel Discussion (Misc queries) 4 June 23rd 08 05:08 PM
can a spreadsheet go past column IV? S Sharp Setting up and Configuration of Excel 2 October 31st 07 07:30 PM
sum if column heading in in past Kirstie Adam Excel Worksheet Functions 5 August 3rd 07 04:28 PM
Sum if the column heading is in the past? Kirstie Adam Excel Worksheet Functions 1 August 1st 07 02:07 PM
column help- can I go past IV? shantymay23 Excel Discussion (Misc queries) 4 June 24th 06 07:19 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"