Macro To Delete Previous Date

Jun 23, 2007

I need a macro to loop through a column and delete any date prior to todays date, as well as all cells in the deleted date's row.

View 2 Replies


ADVERTISEMENT

Create Macro That Filter Date In A Column From One Week Previous Till Current Date

Mar 14, 2014

I have an excel sheet wherin there is a column that has the data where in the dates are displayed and many other columns.

I get this excel every Thursday so i want to filter this date column in such a way that it give me the data related to the date of the previous week only yet there is a catch here. When i say previous week i mean.

Suppose today is 03/14/14 then i want the data from 03/07/14 till today ie Last week friday to this week full( so cant use Current week option) and then paste it in a new sheet.

I tried the Record part but in that it is taking a hard coded value as i am selecting the date myself. I dont want to change the date manually every time.

this was the macro that was created

Code:
ActiveSheet.Range("$A$1:$BX$58").AutoFilter Field:=1, Operator:= _
xlFilterValues, Criteria2:=Array(1, "3/10/2014")
Range("A59").Select
ActiveCell.FormulaR1C1 = "=COUNT(R[-4]C:R[-1]C)"
Range("A60").Select

View 8 Replies View Related

Macro: Return Previous Working Days Date

Dec 1, 2006

how do i get the previous days working date in VBA, how can i get VBA to determine wether we are in the week, and how will i get it to know its a monday to retrieve fridays date?

View 3 Replies View Related

Delete Previous Months Data

Feb 15, 2009

OK essentially this is my problem:

I have a daily spreadsheet, uou update for inputs and outputs each day and the spreadsheet gets to an overperformance figure (sorry if the spreadsheet is a lottle unclear, it is a simplified version)

On the first day of each month, the opening target is adjusted and you start again. The probelm is you dont know what the opening target is until roughly 21st of the month.

I created a macro that deletes the opening target and removes all the previous days before the start of the month.

The way i done this was:

Create a copy of "daily" tab, change b5 to equals c2 and copy and paste special as values. Then in d5-d58 and f5 - f58, vlookup values from old "daily" tab , and then copy and paste special as values. Then delete old "daily" tab and remname daily(2) as "daily"

What i have done is essentially created a new tab on 21st March, looking back to data only as far back as 1st Mar and the new opening bal and target is found. The macro can be used on the 21st of each month.

but...macro doesnt work, i have tried a few times and i think it is because i am vlookuping up data from a tab that i later delete...please help!! - thanks a mil to anybody that can give me a steer in the right direction.

View 14 Replies View Related

How To Create VBA To Delete Previous VBA Modules

Jan 27, 2010

I would like to create some VBA that looks for sub's or modules and delete them.

View 9 Replies View Related

Count Date Cells Where Date Is Previous Month

Oct 25, 2006

I have a spreadsheet which I use to track when a work request is recieved, when we confirm the request and when we action the request. I have been trying to write some code to count the amount of requests, receipts and actions we have processed in the last month.

My first column shows who the request is from
The second shows date recieved
The third shows date we send receipt
The fourth shows the date actioned.

View 9 Replies View Related

Move Every Other Cell In A Column To Row Above It Then Delete Previous Row

Jul 11, 2014

I have a spreadsheet that I need to rearrange to improve readability. I have an example attache, which is easier to understand than describing it, but I'll try:

I want to start in a1, move to a2
copy a2 to b1
delete line 2 (the previous lrow 3 now becomes row 2
if a2 > 0.01, skip it and
move & select cell a3
... and repeat the above logic, on the next series of cells...

E.g.
copy a3 to b2
delete line 3 (the previous lrow 4 now becomes row 3
if a3 > 0.01, skip it and
move & select cell a4
...and repeat the sequence again.

View 2 Replies View Related

Macro To Delete Row By Date?

Jun 4, 2013

I am going to record a macro to clean up a report but the first thing I need to do is delete rows that contain dates before July 17, 2012. The dates are in column B. Is this possible in the macro?

View 5 Replies View Related

Check Whether Date Is A Month After Previous Date?

Dec 12, 2013

I'm sent a file every day where column A contains a month & year but in "general" format.

For example;

Column A, starting with cell A1 with the next date in A2, etc
Jan15
Feb15
Mar15
Apr15

Is there a way through a formula or macro that I can use in order to run through all the dates in this column to make sure that the next cell down is always the month after the cell above it? The dates go all the way through to 2018 in the above format.

View 3 Replies View Related

Finding The Date Of Previous Monday Of Certain Date..

May 4, 2009

I need a VBA code which tells me the date of previous monday of any date. The user types in any date to the cell A1, and I need the date of previous monday to be inserted to the cell A2.

For example:
A1: 9/5/2009 --> A2: 4/5/2009
A1: 19/5/2009 --> A2: 18/5/2009
A1: 27/12/2009 --> A2: 21/12/2009

View 4 Replies View Related

Macro - Delete Row If Column Has Certain Date

Feb 15, 2010

I generate a report in excel of about 63000 rows (this differs) there are several columns with dates, I wish to remove all the rows with a date before and after certain dates.

It seems I would need a loop for that, but it is unclear to me how this works, so far I have this:

Sub TestMacro2()
Columns("D:E").Select
Selection.NumberFormat = "m/d/yyyy"
Columns("L:M").Select
Selection.NumberFormat = "m/d/yyyy"
Rows("2:2").Select
ActiveWindow.FreezePanes = True
Rows("1:1").Select
Selection.AutoFilter
Range("$D").Select
For Each cell In Selection
If Date < 1 - 3 - 2009 Or Date > 2 - 3 - 2010 Then
cell.EntireRow.Delete shift:=xlUp
End If
Range("$D").Select
Next cell
End
End Sub

View 13 Replies View Related

Delete Duplicates With Macro Keeping Only Newest By Date

Feb 14, 2011

I have a spreedsheet with 17,000 rows in it. In column D I have ID numbers and in column B I have the dates. There are multiple entries for each ID in column D which gives multiples dates each entry was given in column B. I need a VBA Macro that will identify duplicate entries in Column D and keep only the most recent entry by date in column B.

View 9 Replies View Related

Previous Date To Most Current Date

May 9, 2013

I have a column with a few dates.

I need a formula to display the previous date to the most current date out of the list.

How do I do that?

View 5 Replies View Related

Excel Macro Delete Rows Where Date Criteria Is In Another Sheet

Feb 28, 2014

I am trying to adapt a macro which deletes all rows in Worksheet 1 where the date in column K differs from a date in Worksheet 2. The date in Worksheet 2 will change each day.

I think the macro below could be used, but don't understand how to replace the "Value = ":70:" with a reference to the master date in Worksheet 2.

Sub test() Dim lr As Long, i As Long lr = Range("A1").End(xlDown).Row
For i = lr To 1 Step -1 If Cells(lr, 1).Value = ":70:" Then
Cells(lr, 1).EntireRow.Delete End If lr = lr - 1 Next i End Sub

View 2 Replies View Related

VBA - Getting Previous And Last DATE From Today

Apr 21, 2014

In Excel VBA, is there a way to get the beginning date and the last date for the previous month from TODAY()?

i.e. If TODAY is Jan 3, 2014, then I would like to have the beginning date as Dec 1, 2013 and the end date as Dec 31, 2013.
i.e. If TODAY is Mar 18, 2012, then I would like to have the beginning date as Feb 1, 2012 and the end date as Feb 29, 2012 (yes 29, not 28).

So basically, I need to have the AI to know the beginning of the year (January 2014 - takes Dec 2013) and if it happens to be February, the 'end date' is either 28th or 29th depending on the year.

View 7 Replies View Related

VBA Code To Add 1 To The Previous Date

Jan 4, 2010

I have a folder containing excel files with dynamic suffix names. I have files for all days starting from the 1st of the month – for example : Performance_01012010.xls, Performance 02012010.xls, Performance_03012010.xls till Performance_31012010.xls.

I want a VBA code to retrieve the date out and change it automatically (means it should add 1 automatically to the previous date). For example, if I open Performance_05012010.xls, my macro should SAVE AS this file to Performance_06012010.xls.

View 9 Replies View Related

2 Different Dates But Chose The Previous Date?

Aug 15, 2014

I have a date that has to be amended every now and then because the date is changing (bcoz of Night Shift), hence, I need to know a formula that.

IF Time is within 8:00 PM (Aug 15) until 5:00 AM (Aug 16), the Aug 15 will prevail.

View 3 Replies View Related

Always Making The Date The Previous Sunday

Dec 14, 2007

Is there a way to make the date in a cell check the current date then fall back to the previous sunday unless today actually happens to be sunday? So for example it would look at today and make the date 12/9/2007 rather than 12/14/2007

View 11 Replies View Related

Code To Clear Previous Date

Feb 24, 2013

I have a Userform that exports data. I tried adding the following code to clear the export sheet each time and it crashes:

Set Popul = Sheets("Sheet2").Range(("a2"), Range("A2").End(xlDown))
Popul.EntireRow.ClearContents

Additionally I want to leave the top row as it has titles that will be needed.

View 8 Replies View Related

Highlight Date If Previous Month

Mar 13, 2008

Need to be able to highligh data within a range where the date in a column is for the previous month/s- therefore need to be able to also include in macro entering the current month - don't want to have to edit macro each month

View 2 Replies View Related

Auto Calculate End Date Of Previous Month

Jan 28, 2009

I have a cell in which I will input the last day of a month (e.g., 1/31/09, 2/28/09, etc.) In another cell, I want Excel to show the last day of the previous month. Is there a formula to calculate this automatically?

I enter in Cell 1: 1/31/09
Excel calculates in Cell 2: 12/28/08

I enter in Cell 1: 2/28/09
Excel calculates in Cell 2: 1/31/09

View 2 Replies View Related

Find Date Of Weekday In Previous Week.

Sep 27, 2009

I've been racking my head on this one.

I need a function where for a given date will return the date of a specified weekday in the previous week.

Example: If today is Friday Sept. 25th 2009 and I want to find the date of
the Wednesday in the previous week I would need something
like DATEPREVIOUSWEEK("09/25/2009", vbWednesday)

View 9 Replies View Related

VBA Code To Return Previous Friday And Month Before Date

May 8, 2014

How to write a VBA code so that it would calculate the date of the previous Friday and from there Return the date exactly 1 month before; on any given day.

For example...
today is may 8th

So if I run the code the dates returned for last friday should be 05/02/2014
and 04/04/2014 should be returned AS the DATE exactly a month from 05/02/2014

View 6 Replies View Related

Find Last Previous Non Blank Value And Summarize Previous 6 Months?

Dec 10, 2012

see attached file. Need to find latest non blank value - in attached file it is highlighted in yellow. From there, want to summarise 26 weeks back so, in the attached file:

Row 2 would be finding 750 and summarised back 26 weeks from 30 sep 2012
Row 3 would be finding 2250 and summarised back 26 weeks from 2 dec 2012
Row 4 would be finding 5000 and summarised back 26 weeks from 4 nov 2012

View 7 Replies View Related

Macro To Delete Cell Contents If Date In One Cell Bigger Than Date In Another Cell

May 9, 2012

I have the following columns that return cover period dates.

Start of Cover PeriodEnd of Cover Period01-Nov-0631-Jan-0701-Jul-0831-May-0901-Dec-0930-Jun-1001-Jan-1131-Dec-10

I however need a macro that will delete the cell contents if the "Start of Cover Period" (column AK) date is > than the "End of cover period" (column AL) date.

Thus it must compare ak2 with al2 and if ak2>al2 then clear both cells. if AK2

View 2 Replies View Related

Select Previous Sheet Macro

May 1, 2013

Below is a macro I'm trying to create. The basically it's supposed to be a quick simple macro to save lots of time. I want to select current tab, move/copy (create copy) to the end....then select the tab I've just copied and copy paste special the values (then rename the tab to todays date) FYI the tab I'm copying is called rebuy shipping.

However, I want to then do the same at a later date with the most recent tab, but with the below code it always selects and copies the original tab:

Sub macrorebuy1()
'
' macrorebuy1 Macro
'
' Keyboard Shortcut: Ctrl+k
'
Sheets("Rebuy Shipping").Select

[Code] .....

I assume this is a simple error. I've tried inserting Activesheet.previous.

View 2 Replies View Related

Run A Macro The Previous 31 Rows Are Hidden?

Jan 29, 2014

I have a spreadsheet with 31 rows and 8 columns that are completed as a checklist.

I have a macro that currently increments where required and also pastes the 31 rows again after

What I am looking for is some code whereby if I run a Macro the previous 31 rows are hidden

View 5 Replies View Related

Macro For Next & Previous Sheet Selection

Sep 6, 2007

I have created a toolbar that has "Previous Worksheet" and "Next Worksheet" buttons on it with the following macros assigned:

Sub NextSheet()
On Error Resume Next
If ActiveSheet. Name = "Problem Listing" Then
MsgBox "This is the last worksheet."
Else
ActiveSheet.Next.Select
End If
End Sub

Sub PreviousSheet()
On Error Resume Next
If ActiveSheet.Index = 1 Then
MsgBox "This is the first worksheet."
Else
ActiveSheet.Previous.Select
End If
End Sub

This seems really simple but the code crashes after 4 or 5 repeated clicks of the button.

View 4 Replies View Related

Going Back To Previous Cell Within Loop Macro

Jul 13, 2009

I need to copy a changing source cell, paste its value into another specific cell (always the same), and then return to the source cell for continued action (ie range selection, copy & value paste, which I can code).

This action is then followed in the next cell to the R of the first cell copied, etc to end of data. I can code the move to the R.

How do I return to the source cells as part of a loop?

Specific notes included in attached - I hope I've explained it clearly.

View 12 Replies View Related

How To Repeat Number According To Previous Cell Using Macro

Jan 6, 2014

I am new to macro. I am trying to convert the following from column 1 to column 2.

1
1

0
1

3
3

[Code] .....

In the left column, the numbers who are greater than 0 can have the same number of rows of zero.

Is there anyway I can do it to convert Column 1 to column 2.

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved