Convert - VBA to Script

Andriana 1 Reputation point
2021-11-18T13:58:42.117+00:00

Hello,

I would like to ask you, if there is a way to convert automatically a macro code into a script file.
Recently, I started using the MS 365 online and I noticed that I have to use script files instead of macros.

This is the code that I would like to convert into a script file:

Sub test()
With Range("a2", Range("a" & Rows.Count).End(xlUp)).Columns(10)
.Formula = "=concatenate(b2,""/"",c2,""/"",text(a2,""mmyy""),"""",substitute(address(1,countifs(b$2:b2,b2,c$2:c2,c2,a$2:a2,a2),4),1,""""))"
.Value = .Value
End With
End Sub

Your help will be much appreciated!

Thank you in advance!

Microsoft 365 and Office Development Other
Microsoft 365 and Office Development Microsoft 365 Publishing
Developer technologies Visual Basic for Applications
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Nancy Wang 116 Reputation points Microsoft Employee
    2021-11-19T20:57:39.633+00:00

    Hey @Andriana !

    PM from the Office Scripts team here - happy to see you're trying out our feature :) We currently don't offer a VBA to macro converter, but one thing I've found useful is to try using the Action Recorder to record the steps I might take in my macro, then looking at and tweaking the resulting code in the code editor. Let me know if this helps, happy to investigate any issues you have with the conversion process.

    Cheers,
    Nancy

    2 people found this answer helpful.

  2. John Korchok 6,126 Reputation points
    2021-11-18T17:45:10.803+00:00

    Sorry, no. VBA works only in Word for Windows and Word for Mac. Other platforms require that you program in JavaScript using Office.js. There is no VBA to JavaScript convertor that will turn VBA macros into JavaScript add-ins.

    1 person found this answer helpful.
    0 comments No comments

  3. Daniel 1 Reputation point
    2022-03-23T06:17:58.607+00:00

    Hello @Nancy Wang ,

    I want to programme an Excel Script where the Cursor jumps to the first free cell in row A.
    In VBA the programming was ctrl+←, then ctrl+ ↓ and then ↓.
    Is there a possibility to jump in the first free cell in row A by programming in typescript,too?

    Thank you in advance.
    Best regards
    Daniel

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.