Excel VBA code to return weekday name from a date then autofilters for userdefined weekday

exlover

New Member
Joined
Oct 9, 2015
Messages
2
I spent last night looking for an answer to my question but i didn't find anything specific to my ask.

I have a huge sheet that contains lots of data. In Column A, I have the Date and time. I would like to have a VBA code that does few actions.

1) Insert a column B next to column A that gives the weekday name. For example if the date in column A is January 10, 2016 8:30 then column B will have "Sunday"

2) Then the VBA code to filter this sheet based on Column B. For instance given a user input of a particular day (example Friday), the autofilter will filter for 4 days ahead ( Friday, Saturday, Sunday, Monday ).

3) The result of the autofilter then is copied to new blank sheet.

4) In the new sheet I want the vba to delete any row data for the same user defined day ( example Friday ) that has time of less than user defined time (example 8:00 am) in Column A. Finally shifting cells up to remove any blank rows.

Hope I am not overwhelming you with this problem, but I hope I get feedback from one of the brilliant minds in here
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Hi,

I think there might be a better way of doing this:

Why not format the date t/time by using a "Custom Format". For instance enter: DDDD YYYY/MM/DD HH:MM:SS and you will see your date displayed like this: Friday 2016/01/01 00:23:00.

The other point is that if you want the days from a certain date, if you convert all the dates to a day then Excel won't know which Monday is which, so it will be easier to filter using the date.
 
Upvote 0

Forum statistics

Threads
1,216,117
Messages
6,128,937
Members
449,480
Latest member
yesitisasport

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