Update the data in excel instead of deleting -
the below code deleting records want update next column "ok" instead of deleting entire row. please advise changes required.
dim myfilenamedir string dim ws1 worksheet dim irow1 long dim str string myfilenamedir = "c:\users\gshaikh\desktop\book16.xlsx" workbooks.open filename:=myfilenamedir, updatelinks:=0 set ws1 = worksheets("students") str = listview1.selecteditem.subitems(1) msgbox str ws1 .autofiltermode = false irow1 = .range("b" & .rows.count).end(xlup).row .range("b1:d" & irow1) .autofilter field:=1, criteria1:="=*" & str & "*" .offset(1, 0).specialcells (xlcelltypevisible).entirerow.delete end .autofiltermode = false end activeworkbook.save activeworkbook.close
you need remove: (xlcelltypevisible).entirerow.delete
and replace cells.value = "ok"
Comments
Post a Comment