Jump to content

Recommended Posts

Posted

Is there such a thing? I want to store the row number of whatever cell i happen to be in. This is kind of the idea, unfortunately "Activecell.Row" is a VBA command, not autoit.

To make it simpler, I could even write the row numbers 1-whatever into a column...but even then I can't figure out how to extract that into an autoit variable.

#include <Excel.au3>

AutoItSetOption("SendKeyDelay", 500)

$oExcel = _ExcelBookNew()
Send("^g")      ;go to cell
Send("e4")      ;random cell selection
Send("{ENTER}")
$Row = $oExcel.Worksheets(1).Activecell.Row     ;would like this to equal 4 (or whatever row it happens to be)
ConsoleWrite("Row: " & $Row "{ENTER}")
Posted

If you're strictly looking for just the row of the selected cell...

$sRC= $oExcel.ActiveCell.Address                
$aRow = StringRegExp($sRC, "\$\w*\$(\d*)", 3)
$iRow = $row[0]

It's not the best way to go, there are other better ways to write it up but you get the idea. You can also have the .Address method return a different style of address, it's in the MSDN documentation.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...