How would I delete rows in excel if value in a column IS NOT “D”?
Thanks in advance!
dt2 = dt.AsEnumerable.Where(Function (x) not x(“Form Type”).ToString = “D”).CopyToDataTable
@Eric_Wong_Test, What tool would be used for this?
@Eric_Wong_Test, would this delete the rows directly from the excel file and keep the data in the same format. One of the other fields is a clickable link to a website that needs to remain.
It is actually filtering the rows from the datatable
After doing this , write this datatable into the excel file and you can see that results will.be displayed in excel file.
thanks @NIVED_NAMBIAR. is there any way to just delete the records that DO NOT contain a “D” in the Form Type column?
Yup, Find the Index that contains “D”
Then, loop the index and using Remove Data Row
You can use invoke VBA activity,
Range(“A1:H” & cells(rows.count,1).end(xlup).row).autofilter field:=5 ,criteria1:=“D”
Range(“A1:H” & cells(rows.count,1).end(xlup).row). specialcells(xlcelltypevisible). entirerow.delete
Please check this Delete value from column.zip (9.0 KB)
It works for me. Let me know if you faced any issue.
@Jayesh_678 , yours works perfectly. i tried replicating but its not inputting the data on sheet2 for some reason. See my data and file in the folder below:
Delete value from column.zip (47.9 KB)
Actually there is a extra space with "D ". So i used trim function. It works.Delete value from column.zip (47.9 KB)
If it works for you, don’t forget to mark it as a solution…
@Jayesh_678 , I was able to get it to work but I need the active links present because the next step is to click on each of them and scrape data back into the excel file. Is this possible?
Use for each row
Type into :- row.item(“SEC Link”)
Scrape data using get text.
Write it into the excel.
If it not works, I will suggest to create a different question for it with different tag line, so any1 can help you.
@Jayesh_678 , thank you. Before I start going through each row, clicking the SEC Link, and scraping, I need to get the sheet to only contain rows where Form Type = “D” and include the links that can be clicked. Do you know how I could accomplish this?
Currently, the output does not contain links:
We are printing the data on sheet2. That data table is having the expected output with SEC Link.
Please check it once the write range activity for sheet 2(we are using it @ the end)
@Jayesh_678 , yes, I see the data on sheet2 but the links are not active. I need to be able to click on them and go to the webpage.
Okay, after excel application scope, we are using read range, check preserve format option from properties and try.
@Jayesh_678 . I tried that but still getting same result