vba - How to edit current macro to search only column C for a value greater than one specified -


i'm not sure how go this, search through folder of excel files , create new sheet list , link files contain specified search term. question is, how edit @ specified column (e.g., column c). also, how make search numbers greater 1 specified (e.g., excel files have lab values in column c, , i'm trying find excel files have values greater ^)

sub searchwkbooks() dim ws worksheet dim myfolder string dim str string dim single dim sht worksheet  set ws = sheets.add  application.filedialog(msofiledialogfolderpicker)     .show     myfolder = .selecteditems(1) & "\" end  str = application.inputbox(prompt:="search string:", title:="search workbooks in folder", type:=2)  if str = "" exit sub  ws.range("a1") = "search string:" ws.range("b1") = str ws.range("a2") = "path:" ws.range("b2") = myfolder ws.range("a3") = "workbook" ws.range("b3") = "worksheet" ws.range("c3") = "cell address" ws.range("d3") = "link"  = 0  value = dir(myfolder) until value = ""     if value = "." or value = ".."     else         if right(value, 3) = "xls" or right(value, 4) = "xlsx" or right(value, 4) = "xlsm"             on error resume next             workbooks.open filename:=myfolder & value, password:="zzzzzzzzzzzz"             if err.number > 0                 ws.range("a4").offset(a, 0).value = value                 ws.range("b4").offset(a, 0).value = "password protected"                 = + 1             else                 on error goto 0                 each sht in activeworkbook.worksheets                         set c = sht.cells.find(str, lookin:=xlvalues, lookat:=xlwhole, searchorder:=xlbyrows, searchdirection:=xlnext)                         if not c nothing                             firstaddress = c.address                                                             ws.range("a4").offset(a, 0).value = value                                 ws.range("b4").offset(a, 0).value = sht.name                                 ws.range("c4").offset(a, 0).value = c.address                                 ws.hyperlinks.add anchor:=ws.range("d4").offset(a, 0), address:=myfolder & value, subaddress:= _                                 sht.name & "!" & c.address, texttodisplay:="link"                                 = + 1                                 set c = sht.cells.findnext(c)                             loop while not c nothing , c.address <> firstaddress                         end if                 next sht             end if             workbooks(value).close false             on error goto 0         end if     end if     value = dir loop cells.entirecolumn.autofit end sub 

change line set c = sht.cells.find(str, lookin:=xlvalues, lookat:=xlwhole, searchorder:=xlbyrows, searchdirection:=xlnext)

 set c = sht.columns(3).find(str, lookin:=xlvalues, lookat:=xlwhole, searchorder:=xlbyrows, searchdirection:=xlnext) - c column in specified sheet  if c.value<>vbnullstring , c.value > 10 ' code passes line if cell value more 10  

Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -