+ Reply to Thread
Results 1 to 6 of 6

I need a code,macro should detect if today is Monday, delete the data with Friday date.

  1. #1
    Registered User
    Join Date
    08-28-2014
    Location
    india
    MS-Off Ver
    2007
    Posts
    92

    Question I need a code,macro should detect if today is Monday, delete the data with Friday date.

    Please Login or Register  to view this content.
    Sub Boddulus()

    Dim i As Integer
    Dim lrow As IntegerData sheet.xlsm

    i = 1
    lrow = ActiveSheet.UsedRange.Rows.Count

    For i = 1 To lrow

    If Cells(i, 11) <> "*" Then '1st rule
    Range(Cells(i, 1), Cells(i, 11)).Interior.ColorIndex = 3 'color everything that is not * as red

    End If

    If Cells(i, 7) = 0.00001 Then '2nd rule
    Range(Cells(i, 1), Cells(i, 11)).Interior.ColorIndex = 5 'color everything that is not * as blue
    End If
    Next

    Call colordelete

    End Sub

    Sub colordelete()
    Dim i As Integer
    Dim lrow As Integer

    If MsgBox("Are you sure you want to delete?", vbYesNo) = vbNo Then
    Exit Sub
    End If


    i = 1
    lrow = ActiveSheet.UsedRange.Rows.Count

    Application.ScreenUpdating = False

    For i = lrow To 1 Step -1

    If Cells(i, 1).Interior.ColorIndex > 0 Then
    Rows(i).Delete
    End If

    End Sub
    Please Login or Register  to view this content.

    Hi All i have the code where macro colors and deletes all unwanted data. now i want to add one more code where macro should detect if today is Monday and delete the rows which has security date as Fridays date in (column J) in the sheet. i want this to happen only on Mondays and the rest of the days the macro should run with other codes that is (Rule1 &rule 2) .can this be possible with a code in the same sheet.please find the attachment for reference. thanks in advance.....

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: I need a code,macro should detect if today is Monday, delete the data with Friday date

    Unfortunately your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    08-28-2014
    Location
    india
    MS-Off Ver
    2007
    Posts
    92

    Re: I need a code,macro should detect if today is Monday, delete the data with Friday date

    Hi All i have the code where macro colors and deletes all unwanted data. now i want to add one more code where macro should detect if today is Monday and delete the rows which has security date as Fridays date in (column J) in the sheet. i want this to happen only on Mondays and the rest of the days the macro should run with other codes that is (Rule1 &rule 2) .can this be possible with a code in the same sheet.please find the attachment for reference. thanks in advance.....

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    08-28-2014
    Location
    india
    MS-Off Ver
    2007
    Posts
    92

    Re: I need a code,macro should detect if today is Monday, delete the data with Friday date

    Now can some one can please help me..... thanks in advance.....

  5. #5
    Registered User
    Join Date
    08-28-2014
    Location
    india
    MS-Off Ver
    2007
    Posts
    92

    Re: I need a code,macro should detect if today is Monday, delete the data with Friday date

    can someone help me on this...... if it is possible with one macro..............

  6. #6
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Re: I need a code,macro should detect if today is Monday, delete the data with Friday date

    Try this...
    Please Login or Register  to view this content.
    Totally untested as you haven't provided any workbook..
    Regards,
    Vikas Gautam
    Excel-buzz.blogspot.com

    Excel is not a matter of Experience, its a matter of Application.

    Say Thanks, Click * Add Reputation

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. move date to next Monday if date is on a Friday, Saturday or Sunday
    By ea223 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-24-2014, 01:54 PM
  2. RE: VBA Macro Needs Tweaking to Delete Rows Where Date As String is Less Than Today's Date
    By justinbelkin in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-05-2013, 04:54 PM
  3. Schedule Macro to run Monday thur Friday
    By leooclaws in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-04-2013, 03:53 PM
  4. Insert tomorrow's date unless Friday. If Friday, insert Monday's date.
    By Cboeree in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-13-2012, 01:21 AM
  5. Monday to Friday
    By lunar_star in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-09-2007, 12:22 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1