Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Colon at the end of excel file name(ex: problem.xls:1, problem.xls | New Users to Excel | |||
Started out as an Access problem. Now an Excel problem | Excel Discussion (Misc queries) | |||
problem with a conditional max problem | Excel Discussion (Misc queries) | |||
Problem when multipple users access shared xl-file at the same time, macrocode for solve this problem? | Excel Programming |