Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Unable to set ColumnWidth property

The VBA code I'm having trouble with follows:
Set Day_CalColHdr = Range(Data.Cells(1, ColC + 1), Data.Cells(4, ColC2))
Day_CalColHdr.ColumnWidth = 2.5
The commands work fine with custom view zoom set at 85% but when I set it to
25% so I cans see it executing I get a 1004 run time error and the following
error:"Unable to set the ColumnWidth property of the range class." Why does
this happen?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Unable to set ColumnWidth property

can't duplicate the error. Tried it with expansion and contraction and it
works both ways at 25% for a rectangular range of 24 cells over 3 columns. I
thought it might be a screen resolution problem but that does not seem to be
the case, at least on my system, but I am running wide screen.

"DaveL" wrote:

The VBA code I'm having trouble with follows:
Set Day_CalColHdr = Range(Data.Cells(1, ColC + 1), Data.Cells(4, ColC2))
Day_CalColHdr.ColumnWidth = 2.5
The commands work fine with custom view zoom set at 85% but when I set it to
25% so I cans see it executing I get a 1004 run time error and the following
error:"Unable to set the ColumnWidth property of the range class." Why does
this happen?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Column Width error

Thanks for trying to help and going through so much trouble.

Last night we switched from Excel 2003 to excel 2007 and when I ran my macro
again this morning it worked fine in excel 2007. Just so you know, I ran
this same macro in Excel 2003 more than a dozen tmes and it always fails but
only when i zoom out to 25% vice 85%. However, I will have to deal with
people still working in 2003 and I still would like to know what is causing
this. So, let me add some details that were not in my original email and ask
only for some leads an not all the work you did before.

I'm working in a workbook that builds calendars (first 41 columns are data
and last 100+ are columns calendar information). My macro builds other
calendars in other worksheets by swapping out the calendar header information
(i.e. one calendar sequences by month of the year and the next is more
detailed by day of the month). When I start the macro at zoom 85% for the
window it works fine, but when I zoom to 25%, so I can watch it, and then
start my macro all my calendars build as before in separte worksheets except
the last one where the program resizes the columns of the calendar from
standard 8.43 to 2.5 and that's when the error occurs. Doesn't occur in
Excell 2007 though. Just any thoughts on how to recode this to be more
robust and not run into problems when someone with excel 2003 runs this would
be helpful.

"JLGWhiz" wrote:

can't duplicate the error. Tried it with expansion and contraction and it
works both ways at 25% for a rectangular range of 24 cells over 3 columns. I
thought it might be a screen resolution problem but that does not seem to be
the case, at least on my system, but I am running wide screen.

"DaveL" wrote:

The VBA code I'm having trouble with follows:
Set Day_CalColHdr = Range(Data.Cells(1, ColC + 1), Data.Cells(4, ColC2))
Day_CalColHdr.ColumnWidth = 2.5
The commands work fine with custom view zoom set at 85% but when I set it to
25% so I cans see it executing I get a 1004 run time error and the following
error:"Unable to set the ColumnWidth property of the range class." Why does
this happen?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Column Width error

Since I am running Excel 2003 and cannot duplicate the error, I am afraid I
can't offer any suggestions.

"DaveL" wrote:

Thanks for trying to help and going through so much trouble.

Last night we switched from Excel 2003 to excel 2007 and when I ran my macro
again this morning it worked fine in excel 2007. Just so you know, I ran
this same macro in Excel 2003 more than a dozen tmes and it always fails but
only when i zoom out to 25% vice 85%. However, I will have to deal with
people still working in 2003 and I still would like to know what is causing
this. So, let me add some details that were not in my original email and ask
only for some leads an not all the work you did before.

I'm working in a workbook that builds calendars (first 41 columns are data
and last 100+ are columns calendar information). My macro builds other
calendars in other worksheets by swapping out the calendar header information
(i.e. one calendar sequences by month of the year and the next is more
detailed by day of the month). When I start the macro at zoom 85% for the
window it works fine, but when I zoom to 25%, so I can watch it, and then
start my macro all my calendars build as before in separte worksheets except
the last one where the program resizes the columns of the calendar from
standard 8.43 to 2.5 and that's when the error occurs. Doesn't occur in
Excell 2007 though. Just any thoughts on how to recode this to be more
robust and not run into problems when someone with excel 2003 runs this would
be helpful.

"JLGWhiz" wrote:

can't duplicate the error. Tried it with expansion and contraction and it
works both ways at 25% for a rectangular range of 24 cells over 3 columns. I
thought it might be a screen resolution problem but that does not seem to be
the case, at least on my system, but I am running wide screen.

"DaveL" wrote:

The VBA code I'm having trouble with follows:
Set Day_CalColHdr = Range(Data.Cells(1, ColC + 1), Data.Cells(4, ColC2))
Day_CalColHdr.ColumnWidth = 2.5
The commands work fine with custom view zoom set at 85% but when I set it to
25% so I cans see it executing I get a 1004 run time error and the following
error:"Unable to set the ColumnWidth property of the range class." Why does
this happen?

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
Unable to set DisplayAlerts property [email protected] Excel Programming 0 June 23rd 06 09:15 PM
Unable to set the XValues Property Ali Baba Charts and Charting in Excel 2 September 14th 05 04:54 AM
Unable to set Hidden Property LAF[_7_] Excel Programming 2 August 24th 05 11:36 AM
unable to set hidden property davegb Excel Programming 2 March 22nd 05 12:03 AM
Unable to get VLOOKUP property cici Excel Programming 1 February 10th 04 11:24 PM


All times are GMT +1. The time now is 07:31 AM.

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

About Us

"It's about Microsoft Excel"