Excel VBA store countifs output for further operation -
Excel VBA store countifs output for further operation -
i writing application in vba excel. using conditions , counting number of records next functions working fine.
cnt = appexcel.application.countifs(r1, audittype, r2, "fail", userrange1, username & "*")
here r1,r2 , userrange1 range types describing individual cells. if print
r1.address '$e:$e r2.address ' $m:$m on.
i getting number of rows nowadays criteria in "cnt" variable.
i need farther manipulation searching custom cells above range of cells. need store addresses in "range" object. please guide me how can store filtered records in range. don't want re-create area also.
you add together new range worksheet declaring name object in vba , setting it's refersto value address. illustration adds needed declarations , code this. assumes interested in cells in r1 range contain constants:
dim rngfiltered excel.range dim nmnew excel.name '... set rngfiltered = r1.specialcells(xlcelltypevisible) set nmnew = ws.names.add(name:="newrange", refersto:="=" & rngfiltered.address)
excel vba
Comments
Post a Comment