Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default VerticalAlignment = xlTop also removes indent

Hello all,

Running Office 2003 Professional Excel build 11.5612.5703 on XP sp2.

If VerticalAlignment is set to xlTop on a range of cells, and there are
indented cells it also removes the indent. If the property is set via the
UI, the correct indents are maintained.

To duplicate:

1. Enter text into a couple of cells.
2. Add a couple of indents to the cells.
3. Create and run the following macro:

Sub Test()

ActiveSheet.Cells.Select
Selection.VerticalAlignment = xlTop

End Sub

All of the indents will be removed. Wassup? Any help would be greatly
appreciated.

TIA,

Bill


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default VerticalAlignment = xlTop also removes indent

Yes, it does mess up the IndentLevel. Note also that you should use one of
the XlVAlign enums, namely xlVAlignTop. However, as xlVAlignTop and xlTop
have the same value, it does not effect your code:
It would appear this is what the .AddIndent property is for.

With Range("B3:B5")
.VerticalAlignment = xlVAlignTop
.AddIndent = True
End With

NickHK

"AlterEgo" wrote in message
...
Hello all,

Running Office 2003 Professional Excel build 11.5612.5703 on XP sp2.

If VerticalAlignment is set to xlTop on a range of cells, and there are
indented cells it also removes the indent. If the property is set via the
UI, the correct indents are maintained.

To duplicate:

1. Enter text into a couple of cells.
2. Add a couple of indents to the cells.
3. Create and run the following macro:

Sub Test()

ActiveSheet.Cells.Select
Selection.VerticalAlignment = xlTop

End Sub

All of the indents will be removed. Wassup? Any help would be greatly
appreciated.

TIA,

Bill




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default VerticalAlignment = xlTop also removes indent

NickHK,

Thanks for your reply, unfortunately I don't think this will help me unless
I'm missing something. What I am trying to accomplish is to set up a
hierarchical numbering system that is controlled by the number of indents.
Users will add lines and indent them much like an outline. Then I go through
and number them according to the hierarchy.

01 - no indents
01.01
01.02 - two lines with one indent
10.02.01 - this line has 3 indents

I have always hated the fact that Excel defaults to a bottom alignment. It
in not intuitive when you have a wordwrap cell and the adjacent cell has its
data way in the bottom of the cell - exactly the opposite of how reports
normally work. I set up my style sheet to default to top alignment and
wordwrap, but that doesn't work either.

It appears as though I am going to have to itterate through each cell, store
its indentl level, align the cell and then re-apply the indent level. Please
let me know if you have another solution.

Thanks again for your reply,

Bill






I am trying to set the alignment on a Selection instead of having to
itterate each row.
"NickHK" wrote in message
...
Yes, it does mess up the IndentLevel. Note also that you should use one of
the XlVAlign enums, namely xlVAlignTop. However, as xlVAlignTop and xlTop
have the same value, it does not effect your code:
It would appear this is what the .AddIndent property is for.

With Range("B3:B5")
.VerticalAlignment = xlVAlignTop
.AddIndent = True
End With

NickHK

"AlterEgo" wrote in message
...
Hello all,

Running Office 2003 Professional Excel build 11.5612.5703 on XP sp2.

If VerticalAlignment is set to xlTop on a range of cells, and there are
indented cells it also removes the indent. If the property is set via
the
UI, the correct indents are maintained.

To duplicate:

1. Enter text into a couple of cells.
2. Add a couple of indents to the cells.
3. Create and run the following macro:

Sub Test()

ActiveSheet.Cells.Select
Selection.VerticalAlignment = xlTop

End Sub

All of the indents will be removed. Wassup? Any help would be greatly
appreciated.

TIA,

Bill






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default VerticalAlignment = xlTop also removes indent

I have always hated the fact that Excel defaults to a bottom alignment.

So change your 'Normal' style to suit.

FWIW I couldn't replicate the problem.

Regards,
Peter T


"AlterEgo" wrote in message
...
NickHK,

Thanks for your reply, unfortunately I don't think this will help me

unless
I'm missing something. What I am trying to accomplish is to set up a
hierarchical numbering system that is controlled by the number of indents.
Users will add lines and indent them much like an outline. Then I go

through
and number them according to the hierarchy.

01 - no indents
01.01
01.02 - two lines with one indent
10.02.01 - this line has 3 indents

I have always hated the fact that Excel defaults to a bottom alignment. It
in not intuitive when you have a wordwrap cell and the adjacent cell has

its
data way in the bottom of the cell - exactly the opposite of how reports
normally work. I set up my style sheet to default to top alignment and
wordwrap, but that doesn't work either.

It appears as though I am going to have to itterate through each cell,

store
its indentl level, align the cell and then re-apply the indent level.

Please
let me know if you have another solution.

Thanks again for your reply,

Bill






I am trying to set the alignment on a Selection instead of having to
itterate each row.
"NickHK" wrote in message
...
Yes, it does mess up the IndentLevel. Note also that you should use one

of
the XlVAlign enums, namely xlVAlignTop. However, as xlVAlignTop and

xlTop
have the same value, it does not effect your code:
It would appear this is what the .AddIndent property is for.

With Range("B3:B5")
.VerticalAlignment = xlVAlignTop
.AddIndent = True
End With

NickHK

"AlterEgo" wrote in message
...
Hello all,

Running Office 2003 Professional Excel build 11.5612.5703 on XP sp2.

If VerticalAlignment is set to xlTop on a range of cells, and there are
indented cells it also removes the indent. If the property is set via
the
UI, the correct indents are maintained.

To duplicate:

1. Enter text into a couple of cells.
2. Add a couple of indents to the cells.
3. Create and run the following macro:

Sub Test()

ActiveSheet.Cells.Select
Selection.VerticalAlignment = xlTop

End Sub

All of the indents will be removed. Wassup? Any help would be greatly
appreciated.

TIA,

Bill








  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default VerticalAlignment = xlTop also removes indent

The code I posted sets the indent to whatever it was before the change in
VerticalAlignment.
So I don't see the problem.

However, Peter's suggestion is better, as then there will be no change
required, as it will default to top aligned.

NickHK

"AlterEgo" wrote in message
...
NickHK,

Thanks for your reply, unfortunately I don't think this will help me

unless
I'm missing something. What I am trying to accomplish is to set up a
hierarchical numbering system that is controlled by the number of indents.
Users will add lines and indent them much like an outline. Then I go

through
and number them according to the hierarchy.

01 - no indents
01.01
01.02 - two lines with one indent
10.02.01 - this line has 3 indents

I have always hated the fact that Excel defaults to a bottom alignment. It
in not intuitive when you have a wordwrap cell and the adjacent cell has

its
data way in the bottom of the cell - exactly the opposite of how reports
normally work. I set up my style sheet to default to top alignment and
wordwrap, but that doesn't work either.

It appears as though I am going to have to itterate through each cell,

store
its indentl level, align the cell and then re-apply the indent level.

Please
let me know if you have another solution.

Thanks again for your reply,

Bill






I am trying to set the alignment on a Selection instead of having to
itterate each row.
"NickHK" wrote in message
...
Yes, it does mess up the IndentLevel. Note also that you should use one

of
the XlVAlign enums, namely xlVAlignTop. However, as xlVAlignTop and

xlTop
have the same value, it does not effect your code:
It would appear this is what the .AddIndent property is for.

With Range("B3:B5")
.VerticalAlignment = xlVAlignTop
.AddIndent = True
End With

NickHK

"AlterEgo" wrote in message
...
Hello all,

Running Office 2003 Professional Excel build 11.5612.5703 on XP sp2.

If VerticalAlignment is set to xlTop on a range of cells, and there are
indented cells it also removes the indent. If the property is set via
the
UI, the correct indents are maintained.

To duplicate:

1. Enter text into a couple of cells.
2. Add a couple of indents to the cells.
3. Create and run the following macro:

Sub Test()

ActiveSheet.Cells.Select
Selection.VerticalAlignment = xlTop

End Sub

All of the indents will be removed. Wassup? Any help would be greatly
appreciated.

TIA,

Bill








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
Indent Indent Excel Worksheet Functions 2 January 12th 10 10:13 PM
SQL query removes alias BusterC Excel Discussion (Misc queries) 1 February 8th 06 04:35 PM
Indent within a row marilyn Excel Worksheet Functions 3 May 5th 05 05:50 PM
numerical values for verticalalignment | colors Mo Excel Programming 3 March 4th 05 09:50 PM
epxort to excel removes trailing 0's Rommi Saar Excel Programming 2 August 31st 04 08:40 PM


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