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

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
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
Customer
Finish
Order Qty
Received by
Date
Levi's
Button On
3082
XYZ
Levi's
Bad
3120
abc
J Crew
Frost
6287
xyz
7-10-2019

<tbody>
</tbody>
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
I put this code in sheet but it's not working,( column f is date column )
 
Last edited:
Upvote 0
From looking at your post I would have thought column E was the column you wanted to enter date in.
So is column G being used?

I put this code in sheet but it's not working,( column f is date column )
 
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,213,526
Messages
6,114,136
Members
448,551
Latest member
Sienna de Souza

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