Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default date in listbox

I have a listbox which I want to display the day of the
week. It already displays the sheet info, date, but the
day of the week column is exactly like the date column.
The cell i reference within the spreadsheet is a different
cell all together. Here is a sample of the code I'm using:

im SheetData() As String
Set OriginalSheet = ActiveSheet
ShtCnt = ActiveWorkbook.Sheets.Count
ReDim SheetData(1 To ShtCnt, 1 To 4)
ShtNum = 1
For Each Sht In ActiveWorkbook.Sheets
If Sht.Name = ActiveSheet.Name Then _
ListPos = ShtNum - 1
SheetData(ShtNum, 1) = Sht.Name
Select Case TypeName(Sht)
Case "Worksheet"
SheetData(ShtNum, 2) = "Sheet"
End Select
' Display the date
If Sht.Range("B5") Then
SheetData(ShtNum, 3) = Sht.Range("B5")
Else
SheetData(ShtNum, 3) = " "
End If
' Display the day of the week
If Sht.Range("E25") Then
SheetData(ShtNum, 4) = Sht.Range("E25")
'If Sht.Visible Then
'SheetData(ShtNum, 4) = "Yes"
Else
SheetData(ShtNum, 4) = " . "
'SheetData(ShtNum, 4) = "No"
End If
ShtNum = ShtNum + 1
Next Sht
With ListBox1
.ColumnWidths = "75 pt;40 pt;60 pt;50 pt"
.List = SheetData
.ListIndex = ListPos
End With
End Sub

The cell E25 within the spreadsheet is formatted: Custom -
dddd


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default date in listbox

Hi Gilbert,

If the Range("E25") is a date, you'd better change

SheetData(ShtNum, 4) = Sht.Range("E25")

to

SheetData(ShtNum, 4) =format(Sht.Range("E25"),"dddd")

Best Regards

Bill


-----Original Message-----
I have a listbox which I want to display the day of the
week. It already displays the sheet info, date, but the
day of the week column is exactly like the date column.
The cell i reference within the spreadsheet is a

different
cell all together. Here is a sample of the code I'm

using:

im SheetData() As String
Set OriginalSheet = ActiveSheet
ShtCnt = ActiveWorkbook.Sheets.Count
ReDim SheetData(1 To ShtCnt, 1 To 4)
ShtNum = 1
For Each Sht In ActiveWorkbook.Sheets
If Sht.Name = ActiveSheet.Name Then _
ListPos = ShtNum - 1
SheetData(ShtNum, 1) = Sht.Name
Select Case TypeName(Sht)
Case "Worksheet"
SheetData(ShtNum, 2) = "Sheet"
End Select
' Display the date
If Sht.Range("B5") Then
SheetData(ShtNum, 3) = Sht.Range("B5")
Else
SheetData(ShtNum, 3) = " "
End If
' Display the day of the week
If Sht.Range("E25") Then
SheetData(ShtNum, 4) = Sht.Range("E25")
'If Sht.Visible Then
'SheetData(ShtNum, 4) = "Yes"
Else
SheetData(ShtNum, 4) = " . "
'SheetData(ShtNum, 4) = "No"
End If
ShtNum = ShtNum + 1
Next Sht
With ListBox1
.ColumnWidths = "75 pt;40 pt;60 pt;50 pt"
.List = SheetData
.ListIndex = ListPos
End With
End Sub

The cell E25 within the spreadsheet is formatted: Custom -


dddd


.

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 2 takes the value of Listbox 1 Illya Teideman Excel Discussion (Misc queries) 3 April 10th 07 03:20 PM
listbox B conditional of input in Listbox A Kim K Excel Discussion (Misc queries) 1 October 31st 06 08:27 PM
Listbox B if LIstbox A equals Kim K Excel Discussion (Misc queries) 2 October 31st 06 07:03 PM
Date formatting in a multi column listbox Nigel Brown[_2_] Excel Programming 2 September 3rd 03 11:29 AM
Sorting ListBox results or transposing ListBox values to other cells for sorting Rob[_8_] Excel Programming 1 July 9th 03 04:35 AM


All times are GMT +1. The time now is 09:49 AM.

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"