We get some daily excel reports on daily basis. In them we get a table in a sheet. What we have to do as a daily task to copy that table (no. of rows changes but overall structure of that table remain same) and send it via outlook.
For me the challenging part is to get the table range present in a excel sheet. So, as a solution what I am trying to count the total rows in a sheet.
What I trying to do I declare a variable and intialize it with 0 and then iterate for each row in the excel sheet and increment the variable . At last I print the value of the variable which contain the total number of rows in that table. But this is giving Error.
@ujjwal.bansal Your RowCount Variable type should be “Int”
and when you try to print it then use RowCount.Tostring
hopefully it will solve your problem instead of another logic.
I’m not sure what you mean. I’m just explaining that you don’t need to do create a variable to store the count in. You can just directly use DTName.Rows.Count.ToString wherever you want to see the count. Put that directly into your message box (changing DTName to whatever the name of your datatable is)