Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Problem with xlCenterAcrossSelection

I am using the following piece of code to center a title across a changing
range, where intMaxRow (I know the wrong row, column reference) is the last
column.

..Range("A2").Resize(1, intMaxRow).HorizontalAlignment = _
xlCenterAcrossSelection

The problem is that it does not reset the range, it only takes the last
greatest width. For example Previously intMaxRow = 8 and I reset it to
intMaxRow = 4, it will still center it across the 8 rather than the 4.

Any thoughts
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Problem with xlCenterAcrossSelection

Sanj,

Because you are not changing the settings.
Each cell in cols 1 to 8 is CenterAcross.
Setting cols 1 to 4 to CenterAcross is just repeating the existing
settings for those cells.
You can change the settings for cols 5 to 8 back to "General" to
leave columns 1 to 4 as CenterAcross.

Jim Cone
San Francisco, USA


"Sanj" wrote in message
...
I am using the following piece of code to center a title across a changing
range, where intMaxRow (I know the wrong row, column reference) is the last
column.

..Range("A2").Resize(1, intMaxRow).HorizontalAlignment = _
xlCenterAcrossSelection

The problem is that it does not reset the range, it only takes the last
greatest width. For example Previously intMaxRow = 8 and I reset it to
intMaxRow = 4, it will still center it across the 8 rather than the 4.
Any thoughts
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Problem with xlCenterAcrossSelection

Before changing intMaxRow, try resetting the old range's HorizontalAlignment
to something else. Then try centering across.

--
Regards,
Tom Ogilvy

"Sanj" wrote in message
...
I am using the following piece of code to center a title across a changing
range, where intMaxRow (I know the wrong row, column reference) is the

last
column.

.Range("A2").Resize(1, intMaxRow).HorizontalAlignment = _
xlCenterAcrossSelection

The problem is that it does not reset the range, it only takes the last
greatest width. For example Previously intMaxRow = 8 and I reset it to
intMaxRow = 4, it will still center it across the 8 rather than the 4.

Any thoughts



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Problem with xlCenterAcrossSelection

I used the following statement to reset the row alignment and then used the
HorizontalAlignment property and it works. Thank You for your help

.Range("2:2").HorizontalAlignment = xlLeft

Sanj

"Tom Ogilvy" wrote:

Before changing intMaxRow, try resetting the old range's HorizontalAlignment
to something else. Then try centering across.

--
Regards,
Tom Ogilvy

"Sanj" wrote in message
...
I am using the following piece of code to center a title across a changing
range, where intMaxRow (I know the wrong row, column reference) is the

last
column.

.Range("A2").Resize(1, intMaxRow).HorizontalAlignment = _
xlCenterAcrossSelection

The problem is that it does not reset the range, it only takes the last
greatest width. For example Previously intMaxRow = 8 and I reset it to
intMaxRow = 4, it will still center it across the 8 rather than the 4.

Any thoughts




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
Colon at the end of excel file name(ex: problem.xls:1, problem.xls financeguy New Users to Excel 2 January 15th 10 01:15 AM
Started out as an Access problem. Now an Excel problem RobertM Excel Discussion (Misc queries) 2 April 26th 06 07:30 PM
problem with a conditional max problem Brian Cornejo Excel Discussion (Misc queries) 1 February 18th 05 06:25 PM
Problem when multipple users access shared xl-file at the same time, macrocode for solve this problem? OCI Excel Programming 0 May 16th 04 10:40 PM


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