to see data on top

shafiq247

Board Regular
Joined
Feb 8, 2016
Messages
54
Hi good evening
I am working on a file which have lot of data, I daily update that file, now my question if I enter a date in date cell that row go automatically on top of the blank cell
Thanks
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
I don't think your question is all that clear.
It may make more sense to us if you can walk us through an actual example with data.
 
Upvote 0
[TABLE="width: 500"]
<tbody>[TR]
[TD]Customer
[/TD]
[TD]Finish
[/TD]
[TD]Order Qty
[/TD]
[TD]Received by
[/TD]
[TD]Date
[/TD]
[/TR]
[TR]
[TD]Levi's
[/TD]
[TD]Button On
[/TD]
[TD]3082
[/TD]
[TD]XYZ
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Levi's
[/TD]
[TD]Bad
[/TD]
[TD]3120
[/TD]
[TD]abc
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]J Crew
[/TD]
[TD]Frost
[/TD]
[TD]6287
[/TD]
[TD]xyz
[/TD]
[TD]7-10-2019
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
no my question is if I put date in date cell, that row go automatically on top of all rows
 
Upvote 0
This seems to do what you are looking for. This code assumes that you don't have anything in column F.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Range("E2:E" & Rows.Count), Target) Is Nothing Then
    If IsDate(Target.Value) Then
        Target.Offset(, 1).Value = 1
        Range("A1").CurrentRegion.Sort Key1:=Range("F1"), Order1:=xlAscending, Header:=xlYes
        Range("F:F").ClearContents
    End If
End If
End Sub
 
Upvote 0
thanks for assistance,
code is working but there is 1 problem
I want to skip top two rows first one is title of sheet and 2nd is heading of column
 
Upvote 0
Try this

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Range("F3:F" & Rows.Count), Target) Is Nothing Then
    If IsDate(Target.Value) Then
        Target.Offset(, 1).Value = 1
        Range("B2:G" & Range("B" & Rows.Count).End(xlUp).Row).Sort Key1:=Range("G2"), Order1:=xlAscending, Header:=xlYes
        Range("G:G").ClearContents
    End If
End If
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,186
Members
452,615
Latest member
bogeys2birdies

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