Excel Ranges

Emma

Member
Is it possible to assign a variable to the value of a cell, and then incorporate that into the RANGE statement? If so, what would i need to do to acheive this?

Thanks,

Emma
 
Code:
def var ip-xl as com-handle no-undo.
def var WorkBook as com-handle no-undo.
def var WorkSheet as com-handle no-undo.
def var cCell as char no-undo.
def var cVal as char no-undo.

    CREATE "Excel.Application" ip-xl.
    
    ip-xl:Visible = true.
    ip-xl:DisplayAlerts = false.
    
    /* First Workbook */
    WorkBook = ip-xl:Workbooks:Add().
    WorkBook:Sheets(1):Select.
    WorkSheet = WorkBook:Sheets:Item(1).

    /* load some dummy data */
    WorkSheet:Range("A1"):FormulaR1C1 = "C3".
    WorkSheet:Range("C3"):FormulaR1C1 = "Test".

    cCell = WorkSheet:Range("A1:A1"):FormulaR1C1.
    cVal = WorkSheet:Range(cCell):FormulaR1C1.

    /* release com-handles */
    release object WorkBook.
    release object WorkSheet.

    ip-xl:DisplayAlerts = true.
    release object ip-xl.


    message "Value of Cell " cCell  " is " cVal view-as alert-box.

Emma said:
Is it possible to assign a variable to the value of a cell, and then incorporate that into the RANGE statement? If so, what would i need to do to acheive this?

Thanks,

Emma
 
Top