Excel VBA to Applescript Offset Example

  • Thread starter gimme_this_gimme_that
  • Start date
G

gimme_this_gimme_that

'Here is the VBA ...
Sub doOffset()
Dim b As Workbook
Dim s As Worksheet
Dim r As Range
' MsgBox "hello world"
Set b = ActiveWorkbook
Set s = b.Sheets("Sheet1")
Set r = s.Range("A1")
Dim i As Integer
Dim j As Integer
For i = 1 To 3
For j = 1 To 3
r.Offset(i, j).Value = i + j
Next j
Next i
End Sub

-- here is the Applescript
on doOffset()
tell application "Microsoft Excel"
-- display dialog "Hello World"
activate
set b to active workbook
set s to worksheet "Sheet1" of b
set r to range "A1" of s
repeat with i from 1 to 3
repeat with j from 1 to 3
set value of (get offset (r) row offset (i) column offset (j))
to i + j
end repeat
end repeat
end tell
end doOffset

doOffset()
 

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