excel - How to find the row of specific Month and Year in the Column -
i have small issue, below pay out date
column having date format dd/mm/yyyy
. in want find row of specific month , year - example row containing 10-2017.
pay out date 12-05-2016 18-05-2016 22-06-2016 20-07-2016 24-08-2016 21-09-2016 19-10-2016 23-11-2016 21-12-2016 18-01-2017 22-02-2017 22-03-2017 19-04-2017 24-05-2017 21-06-2017 19-07-2017 23-08-2017 20-09-2017 18-10-2017 22-11-2017 20-12-2017 24-01-2018 21-02-2018 24-03-2018
in normal excel ctrl+f , giving month , year (10-2017) found row via code doesn't working - suggestion appreciated
sub find() dim c1 range dim cd long set c = thisworkbook.sheets(1).range("a2:a60").find(what:="10-2017", after:=activecell, lookin:=xlformulas, lookat:=xlpart, searchorder:=xlbyrows, searchdirection:=xlnext, matchcase:=false, searchformat:=false) cd = c.row debug.print (cd) end sub
this date contained in month
public sub finddateinrange() dim rng range dim dat string dim begmonth long, endmonth long dim c set rng = thisworkbook.sheets(1).range("a2:a60") dat = "10-2017" begmonth = dateserial(split(dat, "-")(1), split(dat, "-")(0), 1) endmonth = application.worksheetfunction.eomonth(begmonth, 0) each c in rng if c.value2 >= begmonth , c.value2 <= endmonth debug.print c.row end if next c end sub
Comments
Post a Comment