I have read file from excel 1 and tried to copied some of the data from that first excel to second excel file in the sheet1. And after that my task is to remove headers from first sheet and paste other value in second sheet. There are lot of formulas. But I am getting write Cell error time and again. what might be error.
Did the error occur because I was trying to execute “write Cell” thrice in three different cell of excel sheet 2?
I have used this assign value
formulaResult = “=AnotherCell!A3&REPT(”" “”,AnotherCell!A$2-LEN(AnotherCell!A3))"
And then used “Write cell” to execute this formula
Sheet = “Sheet1”
Range = “B1:B17”
value = formulaResult
But at Write cell I got this error
Write Cell ‘Formula’: Failed setting the current sheet to: Sheet1 in workbook: C:\Users\samraat.maharjan\Documents\DataTest2.xlsx. Original error message: 0x800AC472
AnotherCell is the name of first sheet where Sheet1 is name of secondsheet in my case.
using write cell you are using a range?
can you please show a screenshot
Write cell is used to write into one cell you cannot give a range like A3:A17…you have to give only A3 …if you want the formula to be filled then use auto fill range to fill the data to all cells
@Anil_G I want to write from A1 to all the down depending on number of rows in particular. Here it’s actually 17.
The thing is that I need to write from A to S column. Different values. so, I had to write many write cells.
Then use write cell in A1 and then use auto fill range activity to fill all cells
or create a datatable with one columna nd then use write range
@Anil_G How to use that autofill range. Earlier, I have used this “A” + (Count + 1).ToString() to automatically write in other rows as well. But now, it’s also not working.
Can you please show whicha utofill range are you using modern or classic.?
If classic then you have to give range like
"A2:A" + (count+).ToString
If modern then it actually needs only start cell and it will automatically fill till end
@Anil_G I am actually using classic. Even “A2:A” + (count+).ToString() this didn’t work
Can you please ahow what you tried in a screenshot
I am actually reading from first excel file and writing in second excel file instead for each row loop which is inside excel application scope of second excel file.
Again as mentioned…you are still using write cell activity which should I deally be used only for a single cell and not a range
For write cell write in A2 and then use the below mentioned activity
okay, I got your point. But How do I insert value? there’s no value field
First use a write cell to write into one cell…the first and then use auto fill range…it will write the same value in first cell to all the cells
Well, I have tried with autofill but i got this error. AutoFill method of Range class failed,
Please show how you tried and configured
and I hope there are no filters
its for your information we can provide cell range as well in write cell activity.it will work
My bad you are right…range should be supported
If you want update formula for particular data table rows count and update there those formula just check this images which I created and let me know is this helpful or not note if you want to count header row also then remove check box of read range "add header " I had removed please check
@Sandip_Shahane1 What I am trying to do is copy certain columns (Only three column’s values as mentioned in first image) from first excel sheet and copy it into another excel file. For testing purpose there are 17 rows in each columns. And in the second sheet of second excel sheet. I have used quite a few formula to maintain space. I am getting error while I tried to use write Cell and used Autofill range. I worked half but couldn’t copy all the values.