syno Posted June 15, 2009 Share Posted June 15, 2009 (edited) Hi guys I am trying to write to a cell using a loop with A1 cell referencing, i.e _ExcelWriteCell($oExcel, "PASSED", $i, "D7") However nothing is being written to the cell. It will allow me to use: _ExcelWriteCell($oExcel, "PASSED", $i, 7) But this only allows me to write from column 7. Is there any way to write from cell D7 using A1 referencing or 7,4 using R1C1. Thank you Edited June 15, 2009 by syno Link to comment Share on other sites More sharing options...
PsaltyDS Posted June 15, 2009 Share Posted June 15, 2009 (edited) Hi guys I am trying to write to a cell using a loop with A1 cell referencing, i.e _ExcelWriteCell($oExcel, "PASSED", $i, "D7") However nothing is being written to the cell. It will allow me to use: _ExcelWriteCell($oExcel, "PASSED", $i, 7) But this only allows me to write from column 7. Is there any way to write from cell D7 using A1 referencing or 7,4 using R1C1. Thank you The A1 reference "D7" is column "D" (the fourth column) on row 7. So you could either use "D7" for A1 format and leave the column parameter off, or use "7, 4" for R1C1 format. You can't mix them. Since you want to iterate at least one of the values with a variable, the later is more appropriate: $r = 7; row 7 $c = 4; column D _ExcelWriteCell($oExcel, "PASSED", $r, $c) Edited June 15, 2009 by PsaltyDS 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 More sharing options...
syno Posted June 16, 2009 Author Share Posted June 16, 2009 The A1 reference "D7" is column "D" (the fourth column) on row 7. So you could either use "D7" for A1 format and leave the column parameter off, or use "7, 4" for R1C1 format. You can't mix them. Since you want to iterate at least one of the values with a variable, the later is more appropriate: $r = 7; row 7 $c = 4; column D _ExcelWriteCell($oExcel, "PASSED", $r, $c) Hi Thanks for your help with this. If I use; _ExcelWriteCell($oExcel, "PASSED", $i, 4, 7) I get an error message: 'ERROR: _ExcelWriteCell() called with wrong number of args.' and 'Incorrect number of parameters in function call.:' However if I use: _ExcelWriteCell($oExcel, "PASSED", $i, "D7") Nothing gets written to excel at all, this is also true if I use a different cell reference like "E8". I can understand why 4,7 does not work with that extra iteration ($i). But I do not know why "D7" does not work. It just seems to ignore it completely and I get no error messages. Thank you Link to comment Share on other sites More sharing options...
99ojo Posted June 16, 2009 Share Posted June 16, 2009 Hi,i think you haven't understand PsaltyDS.As he wrote:The A1 reference "D7" is column "D" (the fourth column) on row 7. So you could either use "D7" for A1 format and leave the column parameter off, or use "7, 4" for R1C1 format. You can't mix them. My code:#include <Excel.au3>$oExcel = _ExcelBookNew()$c = 4; column DFor $i = 1 To 7 _ExcelWriteCell($oExcel, "PASSED", $i, $c)Nextwrites PASSED in the fourth column on row 1 to 7. So check your code again.;-))Stefan Link to comment Share on other sites More sharing options...
syno Posted June 16, 2009 Author Share Posted June 16, 2009 Hi,i think you haven't understand PsaltyDS.As he wrote:The A1 reference "D7" is column "D" (the fourth column) on row 7. So you could either use "D7" for A1 format and leave the column parameter off, or use "7, 4" for R1C1 format. You can't mix them. My code:#include <Excel.au3>$oExcel = _ExcelBookNew()$c = 4; column DFor $i = 1 To 7 _ExcelWriteCell($oExcel, "PASSED", $i, $c)Nextwrites PASSED in the fourth column on row 1 to 7. So check your code again.;-))StefanThank you for your response but I would like to start writing to row 7 and not row 1... Link to comment Share on other sites More sharing options...
99ojo Posted June 16, 2009 Share Posted June 16, 2009 Thank you for your response but I would like to start writing to row 7 and not row 1...So just change For loop:#include <Excel.au3>$oExcel = _ExcelBookNew()$c = 4; column DFor $i = 7 To 15_ExcelWriteCell($oExcel, "PASSED", $i, $c)Nextwrites PASSED in the fourth column on row 7 to 15;-(( Link to comment Share on other sites More sharing options...
syno Posted June 16, 2009 Author Share Posted June 16, 2009 So just change For loop:#include <Excel.au3>$oExcel = _ExcelBookNew()$c = 4; column DFor $i = 7 To 15_ExcelWriteCell($oExcel, "PASSED", $i, $c)Nextwrites PASSED in the fourth column on row 7 to 15;-((Hi 99ojoI cannot change the FOR loop as it makes up an integral part of my code...It seems that I can only write to row one when I am using this FOR loop and not any other rows??????Thanks Link to comment Share on other sites More sharing options...
PsaltyDS Posted June 16, 2009 Share Posted June 16, 2009 Hi 99ojoI cannot change the FOR loop as it makes up an integral part of my code...It seems that I can only write to row one when I am using this FOR loop and not any other rows??????ThanksWhat? That made no sense at all. You were just shown a loop that writes to a series of different rows. What is it about your original loop that can't be changed? 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 More sharing options...
99ojo Posted June 16, 2009 Share Posted June 16, 2009 What? That made no sense at all. You were just shown a loop that writes to a series of different rows. What is it about your original loop that can't be changed? Hi,He should show us his code, so we can see, what he's talking about. He may need a double For Loop, one for the rows, one for the columns??!!??Stefan (as well) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now