title: Convert Google script to VBA
body: <p>I'm trying to convert the google script below to work with Excel. The script is perfectly working in google sheet until I decided to download a copy. Please help.</p>
  
  <p>Thank you.</p>
  
  <pre><code>function copyTo(){
    var ss = SpreadsheetApp.getActiveSpreadsheet();  
    var dupRow = "MedR";
    var copy = ss.getSheetByName(dupRow);
    copy.insertRowAfter(copy.getLastRow());
    copy.getRange(copy.getLastRow(),1,1,copy.getLastColumn()).copyTo(copy.getRange(copy.getLastRow(),1));
  }
  {
    var ss = SpreadsheetApp.getActiveSpreadsheet();  
    var sourceSheet = "Form"; 
    var destinationSheet = "MedR";
  
    var sheet = ss.getSheetByName(sourceSheet);
    var targetSheet = ss.getSheetByName(destinationSheet);
    var range = sheet.getRange("B4");
    var cell1 = range.getCell(1,1).getValue();
    var range = sheet.getRange("F6");
    var cell2 = range.getCell(1,1).getValue(); 
    var range = sheet.getRange("F9");
    var cell3 = range.getCell(1,1).getValue();  
    var range = sheet.getRange("I9");
    var cell4 = range.getCell(1,1).getValue(); 
    var range = sheet.getRange("E7");
    var cell5 = range.getCell(1,1).getValue();  
    var range = sheet.getRange("I3");
    var cell6 = range.getCell(1,1).getValue();  
  
  
    targetSheet.insertRowAfter(1);
  
   targetSheet.getRange("A2").setValue(cell1);
   targetSheet.getRange("B2").setValue(cell2); 
   targetSheet.getRange("C2").setValue(cell3); 
   targetSheet.getRange("D2").setValue(cell4); 
   targetSheet.getRange("E2").setValue(cell5); 
   targetSheet.getRange("F2").setValue(cell6); 
  
   var sheet = ss.getSheetByName(sourceSheet);
   sheet.getRange("B4").setValue("Search here");
   sheet.getRange("F9").setValue(0);
  
  }
  </code></pre>