+ Reply to Thread
Results 1 to 6 of 6

Auto-populate a cell with a date today [Google Apps Script]

  1. #1
    Registered User
    Join Date
    09-14-2015
    Location
    Philippines
    MS-Off Ver
    2010
    Posts
    8

    Auto-populate a cell with a date today [Google Apps Script]

    Hi all!

    Sending the edited version, i hope i get it right. Thank you!

    Its been a while since I posted here. Thank you in advance to all.

    I am using Google Sheet for this code and I tried this code for auto-populate a cell with the a date if the adjacent cell is filled with a text. But it says this "Missing; before statement. (line 3, file "Code")"

    Here is my code.

    Please Login or Register  to view this content.
    Last edited by Kotasyon; 09-26-2019 at 12:55 AM. Reason: Correction of code

  2. #2
    Forum Moderator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    Pro 2019
    Posts
    14,954

    Re: Auto-populate a cell with a date today

    I am moving your thread since this is about Google Sheets and Google Apps macros.

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    When adding code tags, replace your "*" characters with spaces.

    Please take a moment to add the tags. 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, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then 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

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    Making the world a better place one fret at a time | | |會 |會 |會 |會 | |:| | |會 |會
    Please read the rules
    If someone helped you, click on the star icon at the bottom of their post
    If your problem is solved, go to Thread Tools and select Mark This Thread Solved
    Don't attach a screenshot--just attach your Excel file! It's easier and will let us experiment with your data, formulas, and code.

  3. #3
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    UK
    MS-Off Ver
    2010 primarily
    Posts
    3,281

    Re: Auto-populate a cell with a date today [Google Apps Script]

    I don't know much about Google Apps scripts, but I can tell you two things:
    1. You can't just stick Excel VBA inside a script function declaration; and
    2. The function you want is most likely:
    Please Login or Register  to view this content.
    See here: https://developers.google.com/apps-s...riggers/events
    Rory
    Days when we raged, we flew off the page
    Such damage was done

  4. #4
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    2013, Office 365 ProPlus
    Posts
    4,729

    Re: Auto-populate a cell with a date today [Google Apps Script]

    As Rory stated, you can't use VBA within Google Script. It should be written in App Script (variant of Java script).

    For what you are after, read link below. It details step by step, how to implement the script (turning on project) along with how it can be used.
    https://yagisanatode.com/2018/02/21/...google-sheets/
    Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.
    ― Robert A. Heinlein

  5. #5
    Registered User
    Join Date
    09-14-2015
    Location
    Philippines
    MS-Off Ver
    2010
    Posts
    8

    Re: Auto-populate a cell with a date today

    Good Day!

    I have edited my post for more readable content.

    Thank you!

  6. #6
    Registered User
    Join Date
    09-14-2015
    Location
    Philippines
    MS-Off Ver
    2010
    Posts
    8

    Re: Auto-populate a cell with a date today [Google Apps Script]

    Hi! Thank you for your help and used this code, but I had encountered a problem. When I am copying data from a Sheet1 and pasting to the Coded Sheet, only the first data in A1 has a Date.
    Ex: Copy from Sheet1 B1:B5: and paste it to Coded Sheet B1:B5..The only appears in A1. Thank you for your help again.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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