Jump to content

Recommended Posts

Posted (edited)

Hi all,

I need to progress Microsoft Excel colums using a for-loop:

For $i = Asc("A") To Asc("Z")
    ;Do thing in column Chr($i)
Next

 

Once I reach column Z I obviously have to stop.

How would I go about this once the colums start to be so many that the order looks like "...X, Y, Z, AA, AB, AC, AD, ...."  ?

Edited by Radiance
  • Moderators
Posted

@Radiance do you know the columns you want to reference ahead of time, or will it be unknown? If you know, you can just use _Excel_RangeWrite:

#include <Excel.au3>

Local $oExcel = _Excel_Open()
Local $oWorkbook = _Excel_BookOpen($oExcel, @ScriptDir & "\Test.xlsx")
    _Excel_RangeWrite($oWorkbook, Default, "Testing", "A1:AA1")

 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Posted

The Excel UDF comes with a function to convert column letters to numbers and vice versa.
Please check _Excel_ColumnToLetter and _Excel_LetterToColumn.

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted
  On 5/10/2016 at 2:13 PM, water said:

The Excel UDF comes with a function to convert column letters to numbers and vice versa.
Please check _Excel_ColumnToLetter and _Excel_LetterToColumn.

Expand  

Exactly what I was looking for, tyvm!!
 

Posted

:) 

My UDFs and Tutorials:

  Reveal hidden contents

 

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...