• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Can you help me with ListBox Code Please?

Just one last thing. The ListBox called LB_00 displays all data stored in worksheet "Data". Data Worksheets stores all information in a chronological order(Which I love it remains like that). And LB_00 shows me the same information in the same chronological order. I'd love that LB_00 to shows the last entry on top of it. So, I´d love that the last entry to be shown on top of the ListBox. DATA worksheet will remain as it is, but in the ListBox “LB_04”, the last data stored must be shown above. Can it be possible.

Thank you so much.
 

Attachments

  • Data Entry.JPG
    Data Entry.JPG
    177.5 KB · Views: 6
  • Sebastian Data Entry (guests V2).xlsb
    118 KB · Views: 6
  • Data.JPG
    Data.JPG
    86.7 KB · Views: 6
Question...Is there a way to keep the "Reverse Order Checkbox", Chb_01, checked automatically "Checked" all the time as default? I searched on internet on how to do it.
Code:
Private Sub UserForm_Initialize()
    T_00.Value = WorksheetFunction.Max([NBRs]) + 1
    T_01.Value = Format(Now, "mm/dd/yyyy hh:mm AM/PM")
    T_03.List = [rooms_tbl].Value
    Cmd_00.Enabled = True
    Cmd_01.Enabled = False
    Cmd_04.Enabled = False
With LB_00
    .List = [Data_Tabl1].Value
    .ColumnCount = [Data_Tabl1].CurrentRegion.Columns.Count
    .ColumnWidths = "40;90;80;40;190;100;90;50;40;90;100"
    For i = 0 To .ListCount - 1
        .List(i, 1) = Format(.List(i, 1), "mm/dd/yyyy hh:mm AM/PM")
        .List(i, 6) = Format(.List(i, 6), "mm/dd/yyyy hh:mm AM/PM")
        .List(i, 9) = Format(.List(i, 9), "mm/dd/yyyy hh:mm AM/PM")
    Next i
End With
Load_Listbox
Me.EnableEvents = True
T_03.SetFocus
T_00.BackColor = vbWhite
Chb_01 = True 'To automatically keep checked the Reserve Order on
End Sub

When userform opens, "Chb_01 = True" works perfectly, but when a add a new request, update a request, delete a request, Print, or click on "Reset", Chb_01 keep checked but the order of listbox LB_00 changes. Is there a way to keep it as reverse order, no matter if I Add New, Update, Reset, Delete, or Print?

Thank you in advace again.

You are the best.
 

Attachments

  • Sebastian Data Entry (reverse).xlsb
    111.3 KB · Views: 6
Never Mind...I found about how to do it. What I did was jus add this little code: Chb_01 = False before in the corresponding CommandButtons. "Chb_01 = False" to uncheck and then "Chb_01 = True" to check again, so it works perfectly. I said to myself, what about if I uncheck and then check again?. Lucky shot. Thank you so much for everything.

You are the best Belleke.
 
Changing the Reset sub like this is enough.
Code:
Sub reset()
For Each Ctrl In Controls
    If TypeName(Ctrl) = "TextBox" Or TypeName(Ctrl) = "ComboBox" Then Ctrl.Value = ""
    If TypeName(Ctrl) = "CheckBox" Then Ctrl.Value = False
Next Ctrl
Cmd_00.Enabled = True
Cmd_01.Enabled = False
Cmd_04.Enabled = False
T_00.Value = WorksheetFunction.Max([NBRs]) + 1
T_01.Value = Format(Now, "mm/dd/yyyy hh:mm AM/PM")
With LB_00
    .List = [Data_Tabl1].Value
    .ColumnCount = [Data_Tabl1].CurrentRegion.Columns.Count
    .ColumnWidths = "40;90;80;40;190;100;90;50;40;90;100"
    For i = 0 To .ListCount - 1
        .List(i, 1) = Format(.List(i, 1), "mm/dd/yyyy hh:mm AM/PM")
        .List(i, 6) = Format(.List(i, 6), "mm/dd/yyyy hh:mm AM/PM")
        .List(i, 9) = Format(.List(i, 9), "mm/dd/yyyy hh:mm AM/PM")
    Next i
End With
Chb_01 = True
End Sub
 
Is there a way to set a watermark in the middle of a Textbox? I´d love to display "Type to Search" in the middle of the TextBox. Is this possible?
 

Attachments

  • Sebastian Data Entry (reverse).xlsb
    111.3 KB · Views: 5
  • Gray out.JPG
    Gray out.JPG
    85.5 KB · Views: 5
  • watermark.jpg
    watermark.jpg
    20.6 KB · Views: 5
Back
Top