Posts by VBA_newbie_2021
-
-
-
-
Hi,
I have a list box and I want to be able to sort it by clicking or double clicking on the header of each column. Is this even possible?
I have 7 columns: Tracking Number, Location, Date Received, Date Moved, Date Completed, Submitted By and Submitted On.
I've attached the document.
Also, when I update the record the date formatting changes. When I save the initial record, the date format is dd-mmm-yyyy, but when I update it, it puts the date format exactly how you enter it in the date textbox.
For instance, when I save the initial record as 6/1/21, it puts it in the spreadsheet and list box as 01-Jun-2021, but when I update the record and type 6/1/21, it puts it in the spreadsheet and list box as 6/1/21.
It's not a big deal, just a minor annoyance because the date format isn't uniform.
-
One more question.
Why when I update the record does the date formatting change? When I save the initial record, the date format is mm/dd/yyyy, but when I update it, it puts the date format exactly how you enter it in the date textbox.
For instance, when I save the initial record as 6/1/21, it puts it in the spreadsheet as 06/01/2021, but when I update the record and put 6/1/21, it puts it in the spreadsheet as 6/1/21.
It's not a big deal, just a minor annoyance because the date format isn't uniform.
-
Thank you so much! This worked beautifully!!!
-
Hello. I'm new to using macros and I'm trying to create one for keeping track of packages within my company's building. I've been able to Frankenstein a usable macro together, but I'm having trouble with the Search.
When we scan the FedEx barcode, it shows the entire code. However, if someone only knows the 12 digit tracking number that is printed on the label, I want to be able to find it within the larger string of numbers.
For instance, if I scan a tracking number, here is what comes out 1002882030350004522700785515984311. However, I want the macro to be able to search for both the long number as well as 785515984311, which is what is printed on the FedEx tracking label.
Also, I don't understand why the message box pops up three times.
Here's my current code below. This searches for the entire code. I've also attached the document.
Code
Display MorePrivate Sub cmdSearch_Click() Dim x As Long Dim y As Long x = Sheets("Worksheet").Range("A" & Rows.Count).End(xlUp).Row For y = 6 To x If Sheets("Worksheet").Cells(y, 1).Value = txtSearch.Text Then txtTracking = Sheets("Worksheet").Cells(y, 1).Value txtLocation = Sheets("Worksheet").Cells(y, 2).Value txtReceived = Sheets("Worksheet").Cells(y, 3).Value txtMoved = Sheets("Worksheet").Cells(y, 4).Value txtCompleted = Sheets("Worksheet").Cells(y, 5).Value Else MsgBox "Tracking Not Found." txtTracking.SetFocus End If Next y End Sub
Any assistance would be appreciated.
Thank you,
Becky