+ Reply to Thread
Results 1 to 3 of 3

Using Add Row and iterative date function

  1. #1
    Registered User
    Join Date
    09-28-2021
    Location
    US
    MS-Off Ver
    2013
    Posts
    2

    Using Add Row and iterative date function

    Hi All,

    I am having a run time error when running the below script

    Sub CommandButton1_Click()

    Sheets("Sheet1").Range("A4").Select
    ActiveCell.EntireRow.Insert Shift:=xlUp

    Sheets("Sheet1").Range("A4:C4").Select
    Selection.Borders.Weight = xlThin

    Sheets("Sheet1").Range("A4").Select
    ActiveCell.Formula = "=IF(B3<>"",IF(A3="",NOW(),A3),"")"

    End Sub



    I am trying to get a non changing time stamp whenever a row is added using the button "New Sample" in the below excel sheet

    sample drop off.JPG

    I think the problem is the function =IF(B3<>"",IF(A3="",NOW(),A3),"") as the =now() function works the way I want but the dates/time change each time the document is updated.

    I have set up the excel sheet to do enable iterative calculations... do I need to do that to VBA?
    Is there a better way to get the results I want than the above method?

    Thanks

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: Using Add Row and iterative date function

    Part of the reason for using that kind of formula is so you can get non-changing timestamps into a spreadsheet without using VBA. In this case, VBA is doing the thing that you want timestamped, so have VBA enter the time stamp.
    Please Login or Register  to view this content.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Registered User
    Join Date
    09-28-2021
    Location
    US
    MS-Off Ver
    2013
    Posts
    2

    Re: Using Add Row and iterative date function

    Well I'm dumb thank you
    Last edited by kmiss; 09-28-2021 at 10:32 PM.

+ 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. Iterative Function Unstable?
    By sadele89 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-26-2019, 12:02 PM
  2. Iterative function?
    By seanppp in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-15-2015, 08:48 AM
  3. Iterative SUMIF Function Using VBA
    By Stopwatch in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-08-2014, 08:37 PM
  4. Replies: 1
    Last Post: 01-12-2013, 04:14 PM
  5. Create automated iterative function
    By jalal in forum Excel General
    Replies: 3
    Last Post: 08-15-2011, 09:15 PM
  6. iterative function
    By mt45 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-07-2011, 06:04 PM
  7. Iterative process in a VBA function
    By Paul Schmitz in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-13-2011, 02:36 AM

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