VBA formulas in javascript

  • Thread starter Thread starter smr78
  • Start date Start date
S

smr78

Hi,
I'm trying to convert VBA formulas from VBscript to Javascript. The
formulas I wrote in VBscript, find the first blank row and column in a
Worksheet (in fact, they find the last used row and column).Up to now,
I can't find the right syntax in javascript!
Here are the Vbscript routine which runs well

with excel.activeSheet.Cells
r = .Find("*", .Item(1), , , 1, 2).Row ' 1 for xlByRows, 2 for
xlPrevious
c = .Find("*", .Item(1), , , 2, 2).Column ' 2 for xlByColumns,2 for
xlPrevious
.Range(.Cells(r + 1, 1), .Cells(r + 1, c)).Select
end with

I tried these in javascript but give error :

excel.application.Worksheets("2003EC").Activate;
with (excel.application.ActiveSheet.Cells) {
r = Cells.find("*", Cells(1), , , 1, 2).Row; // 1 for xlByRows, 2 for
xlPrevious
c = Cells.find("*", Cells(1), , , 2, 2).Column; // 2 for xlByColumns,2
for xlPrevious
Range(Cells(r + 1, 1), Cells(r + 1, c)).Select;
}

Is there any Excel web site giving tips for VBA formulas translation to
Javascript (or VBscript)?

Thanks for any help
 
Hi,
I found part of the solution with :

excel.ActiveSheet.Cells.find("*", excel.ActiveSheet.Cells(1),null ,null
, 1, 2).Row

I checked that VBA formulas are not case sensitive once in Javascript.

Now I have to find how to select this calculated Range :
Range(Cells(r+ 1, 1), Cells(r+ 1, c)).select

Next post?
 
Back
Top