VBA to Applescript

J

jpeirano

Version: 2008
Operating System: Mac OS X 10.5 (Leopard)
Processor: Intel

Hi, I have de following Excel Macro in VBA code and I need it to be transcribe to Applesripts.
Can anyone help me?

-------
ActiveSheet.Unprotect Password:=""
R = ActiveCell.Row

Rows(R).Select
Selection.Copy
Selection.INSERT Shift:=xlDown
Application.CutCopyMode = False
ActiveSheet.Protect Password:=""
 
L

Laroche J

Version: 2008
Operating System: Mac OS X 10.5 (Leopard)
Processor: Intel

Hi, I have de following Excel Macro in VBA code and I need it to be transcribe
to Applesripts.
Can anyone help me?

-------
ActiveSheet.Unprotect Password:=""
R = ActiveCell.Row

Rows(R).Select
Selection.Copy
Selection.INSERT Shift:=xlDown
Application.CutCopyMode = False
ActiveSheet.Protect Password:=""

------

Thanks

George

Hi George

Try this script:

tell application "Microsoft Excel"

Unprotect ActiveSheet Password ""

set C to Address of ActiveCell
set R to Row of ActiveCell

Select Row R
CopyObject Selection
Insert Selection Shift xlDown
Select Cell C

Protect ActiveSheet Password ""

end tell

I added a few goodies, for example to reselect the original cell after the
copy.

When testing all three methods, your VBA, my AppleScript and the manual
method, I found out that Excel does this insertion very strangely. For
example, if you have cells in column A with these formulas, starting from
A2...
=A1+1
=A2+1
=A3+1
=A4+1
=A5+1

....and you copy A4, the Copied Cells insertion will result in these, again
starting at A2:
=A1+1
=A2+1
=A2+1
=A3+1
=A5+1

Be careful to verify if this produces the intended result for your
application.

JL
Mac OS X 10.4.11
Office v.X 10.1.9, Office 2008 trial
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top