Jump to content

How to change a value in an Array


Recommended Posts

That might be a discrepancy since _ArrayDisplay() shows me the other way around. ;)

Doh! :)

I've made that mistake before too... didn't learn the lesson...

#include <ExcelCOM_UDF.au3>
#include <Array.au3>

$oExcel = _ExcelBookNew ()
If Not IsObj($oExcel) Then Exit

$avCols = StringSplit("A,B,C,D", ",")
For $x = 1 To 4
    For $y = 1 To UBound($avCols) - 1
        _ExcelWriteCell ($oExcel, "Data for " & $avCols[$y] & $x & " cell", $x, $y)
    Next
Next

MsgBox(64, "Test", "Waiting to visually check data...")

$avData = _ExcelFindInRange($oExcel, "Data", "A1:D4")
_ArrayDisplay($avData, "Debug: $avData")

_ExcelBookClose ($oExcel)

When we write "A1" the column is "A" and the row is "1" (which I get backwards 50% of the time...).

When you make calls in ExcelCOM_UDF functions, and give separate numeric coordinates, they are row first then col (as in the _ExcelWriteCell() call above).

When you get the array from _ExcelFindInRange(), [x][2] is the column and [x][3] is the row number, exactly the opposite of what the header for the function says in the UDF. That makes it all better! If Locodarwin can get confused by this, then I'm in good company!

:P

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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