Macro: Unhiding a row daily

  • Thread starter Thread starter GMD
  • Start date Start date
G

GMD

I have created a macro to unhide a row on a spreadsheet that I maintain
daily. The problem that I have is this macro unhides the same row. I do not
know what scripting to use that will unhide the next row down day after day.
General ex: (assuming today was 2/28/09) Each row contains a date, 3/1/09 for
starts. I would need 3/2-3/30/09 hidden. Then the next day I would need to
be able to view 3/1-3/2/09 but have 3/3-3/30/09 hidden. Does anyone have any
scripting for this?
 
Try one of the two macros below...
Second will unhide all rows upto today... the first only today's rows (so if
you don't run it on a day... that days rows will remain hidden)

Sub unhideTodaysRow()
For i = 1 To 31
If Cells(i, 1) = Date Then
ActiveSheet.Rows( i).Hidden = False
Exit Sub
End If
Next
End Sub

or

Sub unhideAllRowsUptoToday()
For i = 1 To 31
If Cells(i, 1) = Date Then
ActiveSheet.Rows("1:" & i).Hidden = False
Exit Sub
End If
Next
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top