VBA - Sort data on TextBox1 from oldest to newest.

Status
Not open for further replies.

Attrazion

New Member
Joined
Mar 11, 2023
Messages
25
Office Version
  1. 365
Platform
  1. Windows
Hi, Can someone help me with this problem? I need to display the oldest to newest data on the textbox based on the month and date in the Notes column.

VBA Code:
Private Sub UserForm_Initialize()

  Dim firstSheet As String
  Dim secondSheet As String
  Dim thirdSheet As String
  Dim Result As String
  
  firstSheet = Worksheets("Precious").Range("D2").Value
  secondSheet = Worksheets("Sol").Range("D2").Value
  thirdSheet = Worksheets("Angel").Range("D2").Value
  
  Results = firstSheet & vbCrLf & secondSheet & vbCrLf & thirdSheet
  
  

  Me.TextBox1.Value = Results
  TextBox1.MultiLine = True

1680425238769.png


Book11.xlsx
AB
1DateNotes
203/05/2023Adrian Santos
303/06/2023Adrian Sanchez
403/06/2023Ranch Book
503/07/2023Auto Sum
603/08/2023Fernandez
703/09/2023Tolentino
803/10/2023Loti
902/04/202304/01: borrowed 21$
1003/12/2023Duke
11
Precious
Cell Formulas
RangeFormula
A9A9=TODAY()


Book11.xlsx
AB
1DateNotes
203/05/2023Adrian Santos 1
303/06/2023Adrian Sanchez 2
403/06/2023Ranch Book 3
503/07/2023Auto Sum 4
603/08/2023Fernandez 5
703/09/2023Tolentino 6
803/10/2023Loti 7
902/04/202304/02: borrowed 25$
1003/12/2023Duke 9
11
Sol
Cell Formulas
RangeFormula
A9A9=TODAY()


Book11.xlsx
AB
1DateNotes
203/05/202303/05: borrowed 11$
303/06/202303/06: borrowed 11$
403/06/202303/06: borrowed 12$
503/07/202303/07: borrowed 13$
603/08/202303/08: borrowed 14$
703/09/202303/09: borrowed 15$
803/10/202303/10: borrowed 16$
911-Mar-2303/11: borrowed 17$
1003/12/202303/12: borrowed 18$
1102/04/202303/29: borrowed 19$
Angel
Cell Formulas
RangeFormula
A11A11=TODAY()
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Hi,

Just sort your data the way you need it ... before populating your TextBox ...
 
Upvote 0
The Excel menu offers A to Z and Z to A sorting ...
 
Upvote 0
Duplicate to: Displays data from oldest to newest VBA

In future, please do not post the same question multiple times. Per Forum Rules (#12), posts of a duplicate nature will be locked or deleted.

In relation to your question here, I have closed this thread so please continue in the linked thread
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,217,055
Messages
6,134,331
Members
449,866
Latest member
veeraiyah

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top