+ Reply to Thread
Results 1 to 2 of 2

Looking for VBA code to stop data updating using today's date.

  1. #1
    Registered User
    Join Date
    10-08-2014
    Location
    Houston, Texas
    MS-Off Ver
    MS 2010
    Posts
    4

    Post Looking for VBA code to stop data updating using today's date.

    Hello Good People,

    I am new to VBA and working on one of my spreadsheet that I update weekly. I have the dates from 1/1/2015 to 12/31/2015 and the data are from "K37:BN401". I wanted to write a code so that the data update will stop at "Today's" date any day I open the spreadsheet to update. I have a code below which tend to update the data to today's date but also have the last value for today copied through to the end of the year. Please any help will be greatly appreciated. Thanks all. Below is my current code:
    Sub Update_WeeklyReport()

    Dim myArray() As Variant
    myArray = Worksheets("Sheet1").Range("K37:BN401").Value


    With Sheets(1).Range("A4")
    .Value = Date
    .NumberFormat = "mm/dd/yy"

    End With

    Dim LastRow As Long

    LastRow = Cells(Cells.Rows.Count, "K").End(xlUp).Row
    Range("K37:BN" & LastRow).FillDown


    End Sub

  2. #2
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Looking for VBA code to stop data updating using today's date.

    Hello Vickymabo,

    Oops!

    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)

    Regards.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

+ 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. Looking for VBA code to stop data updating using today's date.
    By Vickymabo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-10-2015, 02:34 PM
  2. Replies: 5
    Last Post: 09-09-2014, 10:57 PM
  3. If statement - Need to stop the today's date calculation
    By crw reef in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-04-2014, 02:57 PM
  4. Stop cell from updating when a date is reached
    By acampbeb in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-07-2012, 08:27 AM
  5. [SOLVED] Code to auto filter three month segments of data from today's date
    By gryffin13 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-17-2012, 04:51 PM
  6. How do I stop a date from automatically updating?
    By Canwoman88 in forum Excel General
    Replies: 5
    Last Post: 01-09-2006, 03:15 PM
  7. [SOLVED] How do I stop today() from updating date on saved spreadsheets?
    By lionmark in forum Excel General
    Replies: 2
    Last Post: 01-03-2005, 09:06 PM

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