Sort data on exit and conditional formatting

jingles9

New Member
Joined
Jun 12, 2013
Messages
3
Hello, I am new to this and with the help of many people have created an extensive spreadsheet. It highlights yellow if something new was added to the sheet withing the last 7 days (using a date located in column B), it highlights orange if column I is set to expire in 14 days --conditional formatting code =AND($I8>=TODAY(),$I8<=TODAY()+14) and also highlights purple if column M is set to expire in 14 days or has already expired --conditional formatting code: =AND($M8<>"",$M8<=TODAY()+14).
I have two issues left that I just can't seem to solve.

1) When new information is added to the spreadsheet I want to be able to sort the data alphabetically by using Column C. The users have no excel training so I was hoping to have it auto sort on save or if that's not possible, adding a macro button that they can push that will auto sort for them.
The spreadsheet data starts at B8 and goes to P100. (headers located at B7-P7)

2)If the date in column I is set to expire in 14 days, it highlights orange. I would like it to highlight orange if it is set to expire in 14 days, or has already expired, AND there is nothing in column L.

Can anyone assist with this? Any help is greatly appreciated.
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
With the help of rcm, the sorting issue has been solved.
code should be:
Private Sub Worksheet_Activate()
Dim rng As Range, r As Range
Set rng = Range("B8:P100")
Set r = Range("C8:C100")
'If Not Intersect(Target, rng) Is Nothing Then
Application.ScreenUpdating = False
rng.Sort Key1:=r, Order1:=xlAscending, Header:=xlNo, OrderCustom:=1, _
MatchCase:=False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
Application.ScreenUpdating = True
'End If
End Sub
 
Upvote 0
thanks to ACE_XL for the correct formula to fix my second problem. =AND($I8<>"",$I8<=TODAY()+14,$L8="")
 
Upvote 0

Forum statistics

Threads
1,216,025
Messages
6,128,352
Members
449,443
Latest member
Chrissy_M

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