![]() |
Populating list box with number format data
The following snipet of code populates a list box with time data from the
defined range. On the cells in the originating worksheet the data is defined as hh:mm:ss as the number format. However when the list box displays it displays as 0.33476... etc Can some one show me how to display as hh:mm:ss in the list box. With Simple.ListBox5 .RowSource = "" For Each cell In Cells(2, NextCol).resize(LastRow - 1, 1) .AddItem cell.Value Next cell End With -- Regards and Thanks for any assistance. Francis Brown. |
Populating list box with number format data
Hello Francis, To load the ListBox with the data as it appears in the cell, change .AddItem cell.value To .AddItem cell.text Sincerely, Leith Ros -- Leith Ros ----------------------------------------------------------------------- Leith Ross's Profile: http://www.excelforum.com/member.php...fo&userid=1846 View this thread: http://www.excelforum.com/showthread.php?threadid=49291 |
Populating list box with number format data
try
..additem format(cell.value, "hh:mm:ss") or ..additem cell.text -- keepITcool | www.XLsupport.com | keepITcool chello nl | amsterdam Francis Brown wrote : The following snipet of code populates a list box with time data from the defined range. On the cells in the originating worksheet the data is defined as hh:mm:ss as the number format. However when the list box displays it displays as 0.33476... etc Can some one show me how to display as hh:mm:ss in the list box. With Simple.ListBox5 .RowSource = "" For Each cell In Cells(2, NextCol).resize(LastRow - 1, 1) .AddItem cell.Value Next cell End With |
Populating list box with number format data
Francis,
Have a look at the format function. It will be something like ..AddItem format(cell.Value, "hh:mm:ss") Robin Hammond www.enhanceddatasystems.com "Francis Brown" wrote in message ... The following snipet of code populates a list box with time data from the defined range. On the cells in the originating worksheet the data is defined as hh:mm:ss as the number format. However when the list box displays it displays as 0.33476... etc Can some one show me how to display as hh:mm:ss in the list box. With Simple.ListBox5 .RowSource = "" For Each cell In Cells(2, NextCol).resize(LastRow - 1, 1) .AddItem cell.Value Next cell End With -- Regards and Thanks for any assistance. Francis Brown. |
All times are GMT +1. The time now is 12:02 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com