Increasing/Decreasing the # of Cases

wwbwb

Well-known Member
Joined
Oct 20, 2003
Messages
513
Good morning (here at least)

I have the following code which works
Code:
Sub reminder()
Dim dates As Date
dates = Date
  Select Case dates
  Case "10/31"
   MsgBox "happy halloween"
  Case "11/1"
   MsgBox "day after halloween"
  Case "11/4"
   MsgBox "Today is the 4th"
  End Select
End Sub

What I have is a sheet("Reminders") that in col A I have dates and col B I have the reminder. What I want is for the above macro to look and adjust to the number of dates (cases) on the Reminders sheet. So as I add/remove dates from the Reminders sheet, the macros number of cases also adjusts. Any ideas or anyone have a better way of doing this?
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Ok... I think I found a better way. It seems to work so far...

Code:
Sub reminder2()
Dim dates As Date
Dim lastrow As Long

With Sheets("Reminders")
dates = Date
lastrow = Range("a65536").End(xlUp).Row
For Each c In Range("a2:a" & lastrow)
If c = dates Then
MsgBox c.Offset(0, 1), , "Reminder"
End If
Next c
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,263
Messages
6,118,558
Members
448,836
Latest member
miclyzed

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top