I have a row in an excel sheet called NUMBER. I’m using a for each and if statement to check every cell in the row and if that cell only has 7 characters or 5 then it will execute. How would i write the if statment? (if row.(“NUMBER”).ToString.contains 5 characters?)
row(0).ToString.Length = 5 or row(0).ToString.Length = 7
The 0 refers to Column A, you can change it to 1 for Column B, etc. or much better if the data table has headers and you can refer to them by name like
I Would add the method Trim before Length to eliminate Blanks
how would you write that out?
im trying to eliminate empty spaces in the excel cells while looking searching cells that have only 7 characters in the cell
@NATHAN_MORA - if you could share a sample spreadsheet (by masking sensitive info) …we could take a look and assist.
To Trim the row value, you can use below code:
Where “Numbers” is the column name.