+ Reply to Thread
Results 1 to 4 of 4

Please help me with 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

    Please help me with 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_PEIT()

    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
    Last edited by Vickymabo; 08-10-2015 at 05:54 PM. Reason: Forgot to include previous code

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,944

    Re: Please help me with VBA code to stop data updating using today's date.

    You forgot to include your code....
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Please help me with VBA code to stop data updating using today's date.



    Why again a duplicate post ?‼

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

    Re: Please help me with VBA code to stop data updating using today's date.

    This is the code:
    Sub Update_PEIT()

    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

+ 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. 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:30 PM
  3. Replies: 5
    Last Post: 09-09-2014, 10:57 PM
  4. 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
  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. [SOLVED] 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. Replies: 2
    Last Post: 01-03-2005, 09:06 PM

Tags for this Thread

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