Date Range Filter (Start Date to End Date)

SaurabhPandit

New Member
Joined
Dec 20, 2021
Messages
6
Office Version
  1. 365
Platform
  1. Windows
Hello Everyone,
I am a little bit struggling to put a date range filter in VBA. There are total of 3 sheets. One is Summary where I want to put start date(e5) and End date(g5). All data is in a Lithology sheet which I need to filter. And Sheet LithoFilter is where I want to paste filtered data.
Where I am going wrong? Can anyone help me with this?
Thank You


Sub AllGeoFileter()
Sheets("Lithology").Select
Range("A1:BZ50000").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:= _
>=sheets ("Summary").Range("e5"), Operator:=xlAnd, Criteria2:= <=sheets ("Summary").Range("f5")
Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("LithoFilter").Select
Range("a1").Select
Selection.PasteSpecial xlPasteValues
End Sub
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Range("A1:BZ50000").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:= _
>=sheets ("Summary").Range("e5"), Operator:=xlAnd, Criteria2:= <=sheets ("Summary").Range("f5")
1642431742294.png
 
Upvote 0
Bạn đang gợi ý điều này?

Phạm vi ("A1: BZ50000"). AdvancedFilter xlFilterInPlace, CriteriaRange: = _
Criteria1: => = sheet ("Summary"). Range ("e5"), Toán tử: = xlAnd, Criteria2: = <= sheet ("Summary"). Range ("f5")

Vẫn không hoạt động hiển thị màu đỏ cho hai dòng này.
in the region a to z. which column is specified with the other filter condition. And after filtering, where do you take it?
 
Upvote 0
in the region a to z. which column is specified with the other filter condition. And after filtering, where do you take it?
Hi, In a to z region, it is in column G. And after filtering the data I am copy and pasting it into a different sheet naming "AllGeoFilter".
 
Upvote 0
the original spreadsheet was named "Summary"
This is the sheet where the date range is

1642468956183.png


and below one is the sheet in same file where the data is need to filter .
1642468883717.png


after filtering the data it will stored in sheet AllGeoFilter.
 
Upvote 0
Sheet data
1642469215679.png

sheet result
1642469273793.png

code
 

Attachments

  • 1642469303787.png
    1642469303787.png
    8 KB · Views: 12
Upvote 0

Forum statistics

Threads
1,214,523
Messages
6,120,047
Members
448,940
Latest member
mdusw

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