I tried this method but i have an issue
@Soudios - if you are reading that value as string and you want to keep that as is, try that first one…if you are reading as string and use it as double value then use the second…
What i need is to change the numbers on colum “C” in Excel file to 2 decimal
You method is working with all the colum ?
But you didn’t show any numbers as of now…
Yes. when you loop it and you can apply for all the column values…
@Soudios - Personally, I haven’t tried that activity.
I would read the sheet and convert the column value either For each or Using Linq and write it back…this is my approach…
@Soudios - This is what I was thinking…
Here Row(2) is my Column 2 values…
Then Outside the loop use the write range to write the results back to the sheet.
Hope this helps…
Then you need LINQ query for that…Give me few mins…
Going forward, please put that in your requirement clearly so that it would take help us.
@Soudios - Here you go…
Invoke Code
dt.AsEnumerable().ToList().ForEach(Sub(row) row(2)= Math.round(cdbl(row(2)),2))
Invoke Code Arguments
As I said before, use write range to write to your results after that.
It’s not better to use read column or it will execute that for all the excel ?
It will update all the column c values. Before asking the question first please try the solution and see what it is doing
See my screenshot again.
Perfect it works !!! Thank you
But can u explain me how the bot focus on column “C”, i want to know if i will use it next time plz
@Soudios - row(0)= A
Row(1)= B
Row(2)= C…So instead of giving Row(“ColumnName”)…I used Row(2), that’s all…
Once you done with your testing, please mark my post as solution as it help others…Thanks…
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.