Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default Referring to merged columns in range object

I would like to set the Style property of columns 3 & 4 of a range. These
columns are merged, and I can't figure out how to refer to that range. Right
now, I'm using

Range("tblTasks").Columns(3).Style = "Calculated Value"

This gives me a Run-time error '450', "Wrong number of arguments of invalid
property assignment". However, if I change the style reference to "Currency"
or change the Columns(3) to Columns(2), it works.

Can someone tell me what I'm doing wrong? Thanks,
Matthew Pfluger
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Referring to merged columns in range object

Try this -

Range("tblTasks").Offset(, 3).Resize(, 2).Style = "Calculated Value"

or, if tblTasks refers to cells in a single row
Range("tblTasks").Columns(3).Mergearea.Style = "Calculated Value"

Regards,
Peter T

"Matthew Pfluger" wrote in
message ...
I would like to set the Style property of columns 3 & 4 of a range. These
columns are merged, and I can't figure out how to refer to that range.

Right
now, I'm using

Range("tblTasks").Columns(3).Style = "Calculated Value"

This gives me a Run-time error '450', "Wrong number of arguments of

invalid
property assignment". However, if I change the style reference to

"Currency"
or change the Columns(3) to Columns(2), it works.

Can someone tell me what I'm doing wrong? Thanks,
Matthew Pfluger



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default Referring to merged columns in range object

The first suggestion didn't work. It returned a "Cannot change part of
merged cell" error. However, I took your work and changed it to:

wksTaskSht.Range("tblTasks").Columns(3).Resize(, 2).Style = "Calculated Value"

And that worked. Thanks for the shove in the right direction!

Matthew Pfluger

"Peter T" wrote:

Try this -

Range("tblTasks").Offset(, 3).Resize(, 2).Style = "Calculated Value"

or, if tblTasks refers to cells in a single row
Range("tblTasks").Columns(3).Mergearea.Style = "Calculated Value"

Regards,
Peter T

"Matthew Pfluger" wrote in
message ...
I would like to set the Style property of columns 3 & 4 of a range. These
columns are merged, and I can't figure out how to refer to that range.

Right
now, I'm using

Range("tblTasks").Columns(3).Style = "Calculated Value"

This gives me a Run-time error '450', "Wrong number of arguments of

invalid
property assignment". However, if I change the style reference to

"Currency"
or change the Columns(3) to Columns(2), it works.

Can someone tell me what I'm doing wrong? Thanks,
Matthew Pfluger




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
Referring to columns from within a macro Blobbies Excel Discussion (Misc queries) 4 August 9th 09 10:03 PM
Referring first row in range Asif Excel Programming 4 October 4th 07 02:26 AM
Referring to non constant columns Jill1 Excel Programming 2 October 18th 06 08:43 PM
referring to columns/cells using numbers Masa Ito Excel Programming 6 October 3rd 04 07:27 PM
referring to a range Kevin Smith[_3_] Excel Programming 2 September 7th 04 12:24 PM


All times are GMT +1. The time now is 04:35 AM.

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"