-1

I have a button code that works in Excel VBA but I have a sheet I want to apply it to in Google Docs, It essentially finds the rego on the same line in the valet Worksheet and changes the completed Valet cell in the Trades worksheet to todays date.

Any guidance is much appreciated

Sub Done1()

    Dim TodaysDate As Date
    TodaysDate = Now

    Dim Rego As String
    Rego = Range("A3").Value

With Worksheets("Trades").Range("A1:D20")

    Dim FoundRng As Range

    Set FoundRng = .Find(Rego).Offset(0, 21)

    Sheets("Trades").Range(FoundRng.Address) = TodaysDate

End With

End Sub
Pᴇʜ
  • 56,719
  • 10
  • 49
  • 73
  • 1
    I believe you need to use Google Script in Google Docs, which is a bit like javascript. – Alex de Jong Jun 22 '19 at 22:54
  • Note that VBA code does not run in Google Sheets which uses a type of JavaScript. So you need to rewrite your code in Google Script / JavaScript. But this is no translation service so you will need to try this on your own and if you got stuck or errors you can ask a question about that. – Pᴇʜ Jun 24 '19 at 06:52
  • Thanks Peh, Time to scrub up on my JS :) – Nigel Gilmour Jun 24 '19 at 23:53

1 Answers1

1

VBA doesn't work in a web-based tool like Google Sheets, but you can automate these kinds of processes. See the links below for some ideas of how to get started.

https://support.google.com/docs/answer/7665004?co=GENIE.Platform%3DDesktop&hl=en

https://zapier.com/blog/google-sheets-macros/

https://www.howtogeek.com/413334/how-to-automate-google-sheets-with-macros/

https://www.makeuseof.com/tag/automate-tasks-macros-google-sheets/

I haven't used this, but I believe you can simply record a Macro, just like you and in Excel and Word, and at least for basic things, you don't even have to write any code.

ASH
  • 20,759
  • 19
  • 87
  • 200