Help: Conversion VBA to Google Script.

10 views
Skip to first unread message

Vincent Wilkens

unread,
Nov 28, 2022, 10:59:10 AM11/28/22
to Google Apps Script Community
Is it possible to convert this into google script? If so could someone do it for me, help would be appreciated. 

Sub Select_All_Cells_with_Data()

Set rng = ActiveSheet.UsedRange

rng.Cells(1, 13).Select

For i = 1 To rng.Rows.Count
    For j = 13 To rng.Columns.Count
        If rng.Cells(i, j) <> "" Then
            Union(Selection, rng.Cells(i, j)).Select
        End If
    Next j
Next i

Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
        xlNone, SkipBlanks:=False, Transpose:=False

End Sub

cbmserv...@gmail.com

unread,
Nov 28, 2022, 2:34:35 PM11/28/22
to google-apps-sc...@googlegroups.com

Try this:

 

function selectCellwithData()

{

  var sheet = SpreadsheetApp.getActiveSheet();

  var data = sheet.getDataRange().getValues();

  for (var i=0;i<data.length;i++)

  {

    for (var j=0;j<data[i].length;j++)

    {

      if (data[i][j] != "")

      {

        sheet.setActiveSelection(sheet.getRange(i+1,13));

        return;

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/4e28fc40-7458-4d2d-946e-0c20a50a17e8n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages