Macro to Sort Dates

PurrSent

Board Regular
Joined
Jun 7, 2014
Messages
142
Hi, I need more help with this macro, please!

When I run ths Macro (many thanks to Osvaldo Palpeiro and shg for their help with this so far)

Code:
Sub Date_Order_1()
  '
  ' Date_Order Macro
  ' Puts Date (Column B) in ascending order
  '
  ' Keyboard Shortcut:
     
     ActiveSheet.Unprotect Password:=""
     
     With ActiveSheet
       .Unprotect
       .[A16:BZ115].Sort Key1:=[B16], Order1:=xlAscending
       .Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
     End With
        ActiveSheet.Protect Password:=""
  End Sub

Unfortunately, the whole row does not always go with the date, Sponsor etc. As a result, the amounts paid in the bank account and/or data along the row, do not alway tally with the name at the beginning of the row.

Some of the rows appear to be correct whereas others seem to have random data. Some rows even seem to have disappeared altogether

I'm hoping someone can help solve this issue, please?

I appreciate any help and advice offered. Many thanks

Here is a 'mock-up' of the spreadsheet (in principle) which I hope helps appreciate the situation


Example-Sheet-1.jpg
 
Hi yky

How is this different from the current macro, please? It looks the same to me, apart from curved brackets vs square brackets. Am I missing something?

Thanks

Here is the current macro
Code:
Sub Date_Order_1()
  '
  ' Date_Order Macro
  ' Puts Date (Column B) in ascending order
  '
  ' Keyboard Shortcut:
     
     ActiveSheet.Unprotect Password:=""
     
     With ActiveSheet
       .Unprotect
       .[A16:BZ115].Sort Key1:=[B16], Order1:=xlAscending
       .Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
     End With
        ActiveSheet.Protect Password:=""
  End Sub
 
Upvote 0

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
yky

Many thanks for helping me with this. I've now, after studying the code, realised how the code is different, doh!!! ;) This seems to be working well with your changes.

I very much appreciate your help with this
% :)
 
Upvote 0
I'm glad your problem is solved now.
 
Upvote 0

Forum statistics

Threads
1,223,230
Messages
6,170,883
Members
452,364
Latest member
springate

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