Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default How to Format a ListBox column

Thanks for your input Pascal. No luck - it didn't change
the format of the ListBox.
My problem again....

I have a 2 column ListBox 1st dates 2nd text. ListBox is
populated from an array, itself populated from a 2 column
range of cells in the WorkSheet. The 1st worksheet (dates)
column is formatted in the English (GB) format "31/02/04"
However the ListBox shows the dates in the American longer
format "2/31/2004" (without the leading zero for the
month)
How do I format the ListBox to reproduce the dates as they
were in the original source data.
Any suggestions would be greatly appreciated.
Don Bowyer

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default How to Format a ListBox column

How do you populate the listbox ?

--
Regards,

Juan Pablo González

"Don Bowyer" wrote in message
...
Thanks for your input Pascal. No luck - it didn't change
the format of the ListBox.
My problem again....

I have a 2 column ListBox 1st dates 2nd text. ListBox is
populated from an array, itself populated from a 2 column
range of cells in the WorkSheet. The 1st worksheet (dates)
column is formatted in the English (GB) format "31/02/04"
However the ListBox shows the dates in the American longer
format "2/31/2004" (without the leading zero for the
month)
How do I format the ListBox to reproduce the dates as they
were in the original source data.
Any suggestions would be greatly appreciated.
Don Bowyer



  #3   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default How to Format a ListBox column

Hi Juan Pablo
The source data is in "Worksheet2" & consists of three
columns. The first is RangeName "MyBaseDate" containing
dates in form "dd,mm,yy" , the second is associated text
and the third is RangName "MyAlarms". In "MyAlarms" some
cells are blank and some contain an identifier to indicate
an alarm is required on the corresponding date in
column1 "MyBaseDate".

The code below populates a two column ListBox with the
date and associated text of each "alarmed" date.

It works ok, but lists the dates in the US
format "mm,dd,yyyy" instead of in the source
format "dd,mm,yy"

I've tried the Format function but nothing changes.

Here's the code used to populate the ListBox.......

Private Sub ListBox1_Enter()
Count = 0
ListBox1.ColumnCount = 2
ListBox1.TextColumn = 2

Dim MyArray(50, 2) As Variant

Worksheets(2).Activate

For Each cc In Range("MyAlarms")

If cc = "" Then
GoTo Line2
End If
Count = Count + 1
MyDate = cc.Offset(rowOffset:=0, columnOffset:=-2)
MyMessage = cc.Offset(rowOffset:=0, columnOffset:=-1)
MyArray(Count, 0) = MyDate
MyArray(Count, 1) = MyMessage
Line2:
Next cc

ListBox1.List() = MyArray
ListBox1.ColumnWidths = (50)
End Sub

Sorry it's long but that's the story. Any suggestions
would be welcome.
Don Bowyer

-----Original Message-----
How do you populate the listbox ?

--
Regards,

Juan Pablo González

"Don Bowyer" wrote in message
...
Thanks for your input Pascal. No luck - it didn't change
the format of the ListBox.
My problem again....

I have a 2 column ListBox 1st dates 2nd text. ListBox is
populated from an array, itself populated from a 2

column
range of cells in the WorkSheet. The 1st worksheet

(dates)
column is formatted in the English (GB)

format "31/02/04"
However the ListBox shows the dates in the American

longer
format "2/31/2004" (without the leading zero for the
month)
How do I format the ListBox to reproduce the dates as

they
were in the original source data.
Any suggestions would be greatly appreciated.
Don Bowyer



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default How to Format a ListBox column

Try changing this

MyDate = cc.Offset(rowOffset:=0, columnOffset:=-2)

with

MyDate = cc.Offset(rowOffset:=0, columnOffset:=-2).Text

and also, Dim MyDate as String, at the top of the module.

--
Regards,

Juan Pablo González

wrote in message
...
Hi Juan Pablo
The source data is in "Worksheet2" & consists of three
columns. The first is RangeName "MyBaseDate" containing
dates in form "dd,mm,yy" , the second is associated text
and the third is RangName "MyAlarms". In "MyAlarms" some
cells are blank and some contain an identifier to indicate
an alarm is required on the corresponding date in
column1 "MyBaseDate".

The code below populates a two column ListBox with the
date and associated text of each "alarmed" date.

It works ok, but lists the dates in the US
format "mm,dd,yyyy" instead of in the source
format "dd,mm,yy"


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default How to Format a ListBox column

Hi Juan Pablo
As simple as that!! It fixed the problem fine.
Very many thanks - I much appreciate your input.
Regards
Don Bowyer

-----Original Message-----
Try changing this

MyDate = cc.Offset(rowOffset:=0, columnOffset:=-2)

with

MyDate = cc.Offset(rowOffset:=0, columnOffset:=-

2).Text

and also, Dim MyDate as String, at the top of the module.

--
Regards,

Juan Pablo González

wrote in message
...
Hi Juan Pablo
The source data is in "Worksheet2" & consists of three
columns. The first is RangeName "MyBaseDate" containing
dates in form "dd,mm,yy" , the second is associated text
and the third is RangName "MyAlarms". In "MyAlarms" some
cells are blank and some contain an identifier to indicate
an alarm is required on the corresponding date in
column1 "MyBaseDate".

The code below populates a two column ListBox with the
date and associated text of each "alarmed" date.

It works ok, but lists the dates in the US
format "mm,dd,yyyy" instead of in the source
format "dd,mm,yy"


.

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
Listbox format Rich Young Excel Discussion (Misc queries) 0 June 30th 08 09:35 PM
format a listbox gem.g Excel Discussion (Misc queries) 1 June 21st 06 02:58 AM
listbox.value not equal to listbox.list(listbox.listindex,0) ARB Excel Programming 0 October 22nd 03 12:46 AM
Format columns in a ListBox? Soniya Excel Programming 1 October 12th 03 11:40 AM
listbox format... Tom Ogilvy Excel Programming 0 August 28th 03 11:45 PM


All times are GMT +1. The time now is 09:11 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"