LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,059
Default Can I automate Range.mergeCells = True?

In a VBA subroutine, I want to write something like:

Dim r as Range, s as String, n as Long
[...set up r, s and eventually n...]
r.Value = s
r.Resize(1, n).mergeCells = True

The problem is: how can I determine n, the number of colums merge?

My current workaround is to set n to a constant, namely the maximum
number of columns to merge, which I determined by inspection
beforehand. There is nothing to the right of r. I am not happy with
the "by inspection" requirement; I am actually iterating through all
rows in a large worksheet. Moreover, I want n to be the __minimum__
number of columns necessary.
 
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
how do i automate colour to fill a cell if a range of data is inp Lainey25 Excel Programming 1 June 18th 09 05:02 PM
checkbox1 value = true if range got data pswanie Excel Programming 5 February 6th 08 12:00 PM
Undefined MergeArea when MergeCells is true bstobart Excel Programming 1 September 14th 07 04:57 PM
setting range().hidden=True causes range error 1004 STEVE BELL Excel Programming 6 September 2nd 05 02:16 AM


All times are GMT +1. The time now is 02:53 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"