Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Alignment and format in listbox columns

Further to Tom I would add that the ListView control does add alignment
functionality along with a bunch of other things the listbox control lacks.
I recently 'discovered' it reading 'Professional Excel Development' by
Stephen Bullen et al. It seems that all machines with recent Office
versions installed will have this control available. It has to be added to
VB Toolbox palette since it's not part of VBA proper.

If you'd like a truly simple example workbook let me know.


--
Jim
"Claus" wrote in message
...
| Hi
|
| I need to control the alignment and format of colums in a listbox that i
| fill using array.
|
| I need columns 1, 4,5,6 and 7 to be right aligned
| I need columns 1, 4, 5 and 6 to be formatted like this #.###,##
| i've done like this with column 1 in the code: MyArray(Rk, 0) =
| Format(Selection.Value, "##,#0.00")
|
| I need column 7 formatted as percentage.
|
| See the attached picture.
|
| Hoping for help.
|
| Claus Persson
|
|
|


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Alignment and format in listbox columns

Hi Jim

You would really help me with a simple example.

I've loaded the ListView into the toolbox and inserted it, but i don't see
how to control alignment for multiple columns.

Regards,

Claus



"Jim Rech" skrev i en meddelelse
...
Further to Tom I would add that the ListView control does add alignment
functionality along with a bunch of other things the listbox control
lacks.
I recently 'discovered' it reading 'Professional Excel Development' by
Stephen Bullen et al. It seems that all machines with recent Office
versions installed will have this control available. It has to be added
to
VB Toolbox palette since it's not part of VBA proper.

If you'd like a truly simple example workbook let me know.


--
Jim
"Claus" wrote in message
...
| Hi
|
| I need to control the alignment and format of colums in a listbox that i
| fill using array.
|
| I need columns 1, 4,5,6 and 7 to be right aligned
| I need columns 1, 4, 5 and 6 to be formatted like this #.###,##
| i've done like this with column 1 in the code: MyArray(Rk, 0) =
| Format(Selection.Value, "##,#0.00")
|
| I need column 7 formatted as percentage.
|
| See the attached picture.
|
| Hoping for help.
|
| Claus Persson
|
|
|




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Alignment and format in listbox columns

Alignment is set when you create the column header.

LV.ColumnHeaders.Add 2, , "Col2", 70, 2

The last "2" makes this column center aligned. The only documentation I
know of is on MSDN:

http://msdn.microsoft.com/library/de...umnheaders.asp


--
Jim
"Claus" wrote in message
...
| Hi Jim
|
| You would really help me with a simple example.
|
| I've loaded the ListView into the toolbox and inserted it, but i don't see
| how to control alignment for multiple columns.
|
| Regards,
|
| Claus
|
|
|
| "Jim Rech" skrev i en meddelelse
| ...
| Further to Tom I would add that the ListView control does add alignment
| functionality along with a bunch of other things the listbox control
| lacks.
| I recently 'discovered' it reading 'Professional Excel Development' by
| Stephen Bullen et al. It seems that all machines with recent Office
| versions installed will have this control available. It has to be added
| to
| VB Toolbox palette since it's not part of VBA proper.
|
| If you'd like a truly simple example workbook let me know.
|
|
| --
| Jim
| "Claus" wrote in message
| ...
| | Hi
| |
| | I need to control the alignment and format of colums in a listbox that
i
| | fill using array.
| |
| | I need columns 1, 4,5,6 and 7 to be right aligned
| | I need columns 1, 4, 5 and 6 to be formatted like this #.###,##
| | i've done like this with column 1 in the code: MyArray(Rk, 0) =
| | Format(Selection.Value, "##,#0.00")
| |
| | I need column 7 formatted as percentage.
| |
| | See the attached picture.
| |
| | Hoping for help.
| |
| | Claus Persson
| |
| |
| |
|
|
|
|


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Alignment and format in listbox columns

Hi Jim

When using:
UserForm1.ListViewCtl1.ColumnHeaders.Add 2, , "Col2", 70, 2

It get the Run-time error 438:
Object doesn't support this property or method.

I use Excel 2002 SP3, with VBA 6.3.

Regards,
Claus

"Jim Rech" skrev i en meddelelse
...
Alignment is set when you create the column header.

LV.ColumnHeaders.Add 2, , "Col2", 70, 2

The last "2" makes this column center aligned. The only documentation I
know of is on MSDN:

http://msdn.microsoft.com/library/de...umnheaders.asp


--
Jim
"Claus" wrote in message
...
| Hi Jim
|
| You would really help me with a simple example.
|
| I've loaded the ListView into the toolbox and inserted it, but i don't
see
| how to control alignment for multiple columns.
|
| Regards,
|
| Claus
|
|
|
| "Jim Rech" skrev i en meddelelse
| ...
| Further to Tom I would add that the ListView control does add
alignment
| functionality along with a bunch of other things the listbox control
| lacks.
| I recently 'discovered' it reading 'Professional Excel Development' by
| Stephen Bullen et al. It seems that all machines with recent Office
| versions installed will have this control available. It has to be
added
| to
| VB Toolbox palette since it's not part of VBA proper.
|
| If you'd like a truly simple example workbook let me know.
|
|
| --
| Jim
| "Claus" wrote in message
| ...
| | Hi
| |
| | I need to control the alignment and format of colums in a listbox
that
i
| | fill using array.
| |
| | I need columns 1, 4,5,6 and 7 to be right aligned
| | I need columns 1, 4, 5 and 6 to be formatted like this #.###,##
| | i've done like this with column 1 in the code: MyArray(Rk, 0) =
| | Format(Selection.Value, "##,#0.00")
| |
| | I need column 7 formatted as percentage.
| |
| | See the attached picture.
| |
| | Hoping for help.
| |
| | Claus Persson
| |
| |
| |
|
|
|
|




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Alignment and format in listbox columns

I tried to email you my simple example file but Hotmail said your address
wasn't valid :(


--
Jim
"Claus" wrote in message
...
| Hi Jim
|
| When using:
| UserForm1.ListViewCtl1.ColumnHeaders.Add 2, , "Col2", 70, 2
|
| It get the Run-time error 438:
| Object doesn't support this property or method.
|
| I use Excel 2002 SP3, with VBA 6.3.
|
| Regards,
| Claus
|
| "Jim Rech" skrev i en meddelelse
| ...
| Alignment is set when you create the column header.
|
| LV.ColumnHeaders.Add 2, , "Col2", 70, 2
|
| The last "2" makes this column center aligned. The only documentation I
| know of is on MSDN:
|
|
http://msdn.microsoft.com/library/de...umnheaders.asp
|
|
| --
| Jim
| "Claus" wrote in message
| ...
| | Hi Jim
| |
| | You would really help me with a simple example.
| |
| | I've loaded the ListView into the toolbox and inserted it, but i don't
| see
| | how to control alignment for multiple columns.
| |
| | Regards,
| |
| | Claus
| |
| |
| |
| | "Jim Rech" skrev i en meddelelse
| | ...
| | Further to Tom I would add that the ListView control does add
| alignment
| | functionality along with a bunch of other things the listbox control
| | lacks.
| | I recently 'discovered' it reading 'Professional Excel Development'
by
| | Stephen Bullen et al. It seems that all machines with recent Office
| | versions installed will have this control available. It has to be
| added
| | to
| | VB Toolbox palette since it's not part of VBA proper.
| |
| | If you'd like a truly simple example workbook let me know.
| |
| |
| | --
| | Jim
| | "Claus" wrote in message
| | ...
| | | Hi
| | |
| | | I need to control the alignment and format of colums in a listbox
| that
| i
| | | fill using array.
| | |
| | | I need columns 1, 4,5,6 and 7 to be right aligned
| | | I need columns 1, 4, 5 and 6 to be formatted like this #.###,##
| | | i've done like this with column 1 in the code: MyArray(Rk, 0) =
| | | Format(Selection.Value, "##,#0.00")
| | |
| | | I need column 7 formatted as percentage.
| | |
| | | See the attached picture.
| | |
| | | Hoping for help.
| | |
| | | Claus Persson
| | |
| | |
| | |
| |
| |
| |
| |
|
|
|
|




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
Data Alignment in columns Natemoney2 Excel Discussion (Misc queries) 2 July 17th 07 08:30 PM
Dollar format alignment Paul Excel Discussion (Misc queries) 1 February 27th 07 10:16 PM
Alignment and format in listbox columns Tom Ogilvy Excel Programming 0 August 24th 05 01:05 PM
Q: find range, listbox - format and fit columns Mark[_17_] Excel Programming 0 June 8th 04 12:41 PM
Format columns in a ListBox? Soniya Excel Programming 1 October 12th 03 11:40 AM


All times are GMT +1. The time now is 12:07 PM.

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"