excel vba - Find date in a range -


i have many dates in range a1: ww1 mean there 1 date in every cell.

i need macro selects today's date between other dates.

i assume have consistently filled data. if can use used range find out last row. please try code. colour cells having current data. have used limited range testing purposes think work on larger range also.

sub highlight()     dim rng range     dim lastrow long, lngrow long     dim strcolumn integer     lastrow = activesheet.usedrange.rows(activesheet.usedrange.rows.count).row     dim lastcolumn integer     lastcolumn = activesheet.usedrange.columns(activesheet.usedrange.columns.count).column     strcolumn = 1 lastcolumn          activesheet             lngrow = 2 lastrow  ' assuming row 1 header row                 if isdate(.cells(lngrow, strcolumn).value) , cdate(.cells(lngrow, strcolumn).value) = date                 .cells(lngrow, strcolumn).interior.colorindex = 3                 end if             next lngrow         end     next end sub 

snapshot highlighting today's date


Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -