user3155537
user3155537

Reputation: 1

Javascript Conversion from VBA

I am trying to convert a script from VBA to Javascript and I need help. The purpose is to move a spreadsheet into GDocs. First of all here's what the VBA script does along with its code.

Dim lngN As Long
Dim lngCol As Long

Cells.Unmerge
With ActiveSheet.UsedRange
On Error Resume Next
Range("A8:A100").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
On Error GoTo 0
Dim toDel(), i As Long
    Dim RNG As Range, Cell As Long
    Set RNG = Range("A9:J100")

   RNG.RemoveDuplicates Columns:=9
   Dim rLastRow As Range
Set rLastRow = Cells(Rows.Count, "A").End(xlUp)

'now delete last 10 rows:
rLastRow.Offset(0).Resize(2).EntireRow.Delete


Set sourceSheet = Worksheets("BMS Input")
sourceSheet.Activate
sourceSheet.Cells.Select
Selection.Copy
Set destSheet = Worksheets("BMS Data")
destSheet.Activate
destSheet.Cells.Select
destSheet.Paste
Sheets("BMS Input").Visible = False
MsgBox ("Data Input Successful")
MsgBox ("Please allow form data to update. This process may take up to 1 minute.")
ActiveWorkbook.RefreshAll
End With
End Sub

It does the following functions.

  1. Unmerge all cells in the table
  2. Delete all rows with no data in the first column
  3. Delete all rows that have duplicate data in the 9th column
  4. Delete the last 10 rows
  5. After it's done with all that it copys the entire spreadsheet and pastes it to another spreadsheet in the workbook
  6. Refreshes the workbook to get latest data

Is there anyone that can give some guidance as to changes I can/should make in this code to make it work in javascript.

-Thanks in Advance J

Upvotes: 0

Views: 2648

Answers (2)

DICS
DICS

Reputation: 11

I perceive based on the type of methods and classes you are using in your code, you are a Die hard kind of code developer.

So, being in the same category as you, here is a good resource to help you succeed with your code.

This goes to a deeper level of code writing but, I feel like you can handle it.

It is about using Json, ( Java Script Object Notation), formalism along with the powerful cJObject parsing class. Just take a look by yourself.

The documentation and code examples are very thorough.

http://ramblings.mcpher.com/Home/excelquirks/json

If you need the actual book from where most of this reference came from, go here: http://curomediares.com/link/going-gas-free-download-ebook-pdf

Cheers...

Upvotes: 1

Claudia
Claudia

Reputation: 1269

Two things you will need to answer this question:

  1. Get familiar with JavaScript syntax and its features. That will help more than anything else.
  2. Check out this site: http://developers.google.com/apps-script/reference. That has all the documentation you could ever want for this kind of thing.

Upvotes: 1

Related Questions