Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Date formatting still causing me headaches

The code below fails to populate Listboxes 5-7 due to the date formating of
the sheet value and the Listbox4.
The sheet value ((myrow,4) is in a ddd dd mmm yy format, where the Listbox
keeps formatting to a mm/dd/yyyy.

I have tried to format the listbox4 before and after it is populated by:
ListBox4.Value = Format(.Cells(myrow, 4).Offset(, 3).Value , "dd/mm/yyyy")


But i still get NO result with the below due to a MATCH found but NOT
recognised at trhe highlighted line below.

Private Sub ListBox4_Click()
Application.ScreenUpdating = False
TextBox1.Value = ""
ListBox5.Clear
ListBox7.Clear
ListBox6.Clear
ListBox7.Clear
Dim LastCell As Long
Dim myrow As Long
LastCell = Worksheets("Data").Cells(Rows.Count, "D").End(xlUp).Row
With ActiveWorkbook.Worksheets("Data")
For myrow = 1 To LastCell
If .Cells(myrow, 4).Offset(, -3).Value < "" And .Cells(myrow,
4).Offset(, -3).Value = ListBox1.Value And _
ListBox2.Value = .Cells(myrow, 4).Offset(, 3).Value And _
ListBox4.Value = .Cells(myrow, 4).Value Then ' <===== HERE

ListBox7.AddItem .Cells(myrow, 4).Offset(, 231).Value
ListBox5.AddItem .Cells(myrow, 4).Offset(, 230).Value
ListBox6.AddItem .Cells(myrow, 4).Offset(, 7).Value
End If

Next
End With
Sheets("Opening Page").Activate
Application.ScreenUpdating = True
End Sub


The code simply reducing possible senarios to ensure the correct row is
chaosen to be viewed in a sheet.
--
Corey ....
The Silliest Question is generally
the one i forgot to ask.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default Date formatting still causing me headaches

Hi Corey

Not sure if this will help you could try putting the value in to the
listbox as .text rather than .value so that the listbox shows the date
as text rather than a date which would result in you having the
correct format that you could then change back into a date if you need
to. this may be a pain in the ass depending on how you are putting
the values into the listboxes but it may help

Steve


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
Conditional formatting causing Excel to crash No Name Excel Discussion (Misc queries) 3 October 10th 08 03:35 PM
Date pasted web site causing inconsistent date format lilhoot Excel Worksheet Functions 3 October 3rd 08 09:12 PM
Data Validation Headaches! Cam1234 Excel Discussion (Misc queries) 2 April 2nd 08 03:18 PM
Compatibility Checker causing headaches Brian Excel Programming 2 June 29th 07 03:46 PM
Excel Add-in Headaches! Adklover63 Excel Discussion (Misc queries) 3 May 8th 07 08:16 PM


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