Macro that will show a userform when a date is entered in a row that fits within two dates in that same row

benhop

New Member
Joined
Nov 18, 2008
Messages
35
Hey,

I need to create a macro when a user enters a date in column 41, when that entered date is greater than the date in column 5 and less than the date in column 40 of the corresponding row. For example, if a user enters 3/21/09, greater than 3/10/09 located in column 5, and less than 3/30/09 located in column 40 of the same row. In turn, I'd like for this macro to show a userform when a date that meets these conditions is entered. Thanks.

Benhop
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

jbeaucaire

Well-known Member
Joined
May 8, 2002
Messages
6,012
Put this macro into the sheet module where you want this to happen, rename the Userform1 reference to the name of your userform:
Rich (BB code):
Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Range("AO:AO")) Is Nothing Then
        If Target.Value > Range("E" & Target.Row).Value And _
            Target.Value < Range("AN" & Target.Row).Value Then
            UserForm1.Show
        End If
    End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,191,687
Messages
5,988,077
Members
440,125
Latest member
vincentchu2369

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
Top