+ Reply to Thread
Results 1 to 5 of 5

VBA to Google Sheets

  1. #1
    Registered User
    Join Date
    09-28-2018
    Location
    Diamond Bar, California
    MS-Off Ver
    2016
    Posts
    31

    VBA to Google Sheets

    I just finally got a VBA that I could use:

    Please Login or Register  to view this content.
    It basically copies the active sheet, change the name to the date today, change cell A1 to the date today and hide the previous sheet.

    I was hoping to use this on Google Sheets as I am having some issues using Excel across multiple users who all use iOS devices (myself included) where VBA does not work. So after many hours Googling we decided to just use Google Sheets which is easier for all of us.

    How could I convert the above VBA to Google Script

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,445

    Re: VBA to Google Sheets

    I don't know enough (anything) about Google Scripts, but it looks like this has examples of the things you are doing in VBA.

    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor Toonies's Avatar
    Join Date
    07-30-2009
    Location
    Newcastle, UK
    MS-Off Ver
    Excel 2016
    Posts
    503

    Re: VBA to Google Sheets

    check this out
    https://developers.google.com/apps-s.../convert-files

  4. #4
    Valued Forum Contributor janmorris's Avatar
    Join Date
    07-24-2021
    Location
    Japan
    MS-Off Ver
    Google Sheets (& Mac 2021)
    Posts
    1,066

    Re: VBA to Google Sheets

    note: the Macro Converter add-on is restricted to customers using a G Suite Enterprise license.

  5. #5
    Valued Forum Contributor janmorris's Avatar
    Join Date
    07-24-2021
    Location
    Japan
    MS-Off Ver
    Google Sheets (& Mac 2021)
    Posts
    1,066

    Re: VBA to Google Sheets

    you want to:
    1. create a duplicate of the active sheet
    2. name the duplicate with todays date
    3. put the date in cell A1
    4. hide the original sheet


    here is solution for 1,2,3, and 4

    First create an Apps Script, that will contain the following 4 functions:
    1. create a custom menu to easily access and run the scripts
    2. create a custom function to get todays date into a cell
    3. duplicate a source sheet that is a Protected Sheet (then hide the source sheet)
    4. duplicate an unprotected source sheet that has Protected Ranges (then hide the source sheet)

    Please Login or Register  to view this content.
    rename the Custom Menu to your liking
    change the GMT-0 to the timezone of your liking
    save the apps script before continuing.

    next, in order for you to have the date (sheet name) in cell A1, the source sheet must have the same structure, and therefore in cell A1 of the source sheet you can put this formula:

    Please Login or Register  to view this content.
    this uses the second function in the above code

    next, reload the G-Sheet, this will prompt the first function to create a Custom Menu in the header section.

    now, to copy the sheet, make sure it is active (visible) in the browser, and...
    • to copy a Protected Sheet, you simply click on the Custom Menu, and click "Duplicate Protected Sheet"
    • to copy a sheet that has Protected Ranges, but is NOT a Protected Sheet, just click "Duplicate Sheet with Protected Range"
    Last edited by janmorris; 10-22-2021 at 11:55 AM. Reason: added more functionality

+ 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. (Google App Scripts) Copy and paste value for all Google Sheets contained in one folder
    By bobbiekan in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 4
    Last Post: 09-29-2021, 11:48 PM
  2. Google Sheets: Condition formatting in Google sheet
    By cyee in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 4
    Last Post: 02-18-2021, 05:35 PM
  3. [SOLVED] Google sheets script to download file and save it to google drive folder and use it's data
    By western in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 5
    Last Post: 01-18-2021, 01:31 PM
  4. [SOLVED] Google sheets vba to download file and save it to google drive folder and use it's data
    By western in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-14-2021, 08:48 AM
  5. Google Sheets Master Sheet that pulls in data from other sheets with the last edit date
    By Badvgood in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 2
    Last Post: 12-19-2020, 12:04 PM
  6. Google Apps Script for Google Sheets Pulling Formulas from Master to Several Slave Sheets
    By excelroofing in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 4
    Last Post: 08-22-2018, 02:06 AM
  7. email row contents based on cell values (google sheets populated by google forms)
    By reedg in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 0
    Last Post: 01-13-2016, 02:55 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