1

Topic: The macro date selection in a column is less than date system

Children hello! That that is impossible to me a stopper further, does not work a macro:
It would be desirable to see macro operation on such algorithm:
1. At column selection works macro Call date
2. The macro defines in a column "N", date which "Date - 1" there is less than date for one day
Problem: does not work a macro

Option Explicit
Sub date () ' in the unit
Dim b $, a $
a $ = Sheets ("0000").Columns ("N:N").Select
b $ = Date - 1
If a $ = b $ Then MsgBox "an error in date", vbInformation, "message"
End Sub
' on sheet
Private Sub Worksheet_Change (ByVal Target As Range)
If Target. Address = "N:N" Then: Call date
End Sub

2

Re: The macro date selection in a column is less than date system

Because

10> 5

but

"10" <"5"

Esteem about data types in VBA

3

Re: The macro date selection in a column is less than date system

assei wrote:

a $ = Sheets ("0000").Columns ("N:N").Select

And that you wanted to achieve this line I even I can not imagine

4

Re: The macro date selection in a column is less than date system

assei wrote:

the macro defines in a column "N", dates

for this purpose the cycle

assei wrote:

at least is required at column selection works a macro

Worksheet_Change will not work on column selection

5

Re: The macro date selection in a column is less than date system

Shocker. Pro, quitted here position there is such code, but in it it would be desirable not for one day-1, and to filter all the days long less than current date

With Application
.EnableEvents = 0:.ScreenUpdating = 0
With ActiveSheet
If.FilterMode Then.ShowAllData
With.UsedRange
With Intersect (.Columns ("N:O").Offset (1))
.Replace Date - 1, "=zz1", 2, False, False
.Rows. Hidden = True
End With
End With
End With
With [zz1].DirectDependents
.Rows. Hidden = False
.Formula = Date - 1
End With
.EnableEvents = 1:.ScreenUpdating = 1
End With

6

Re: The macro date selection in a column is less than date system

assei;
For a long time already would lay out an example and be defined eventually what exactly should happen to ill-fated dates, and that at you artly issued . If to you them simply to select, so here and macroes are not necessary. It is possible to filter too without macroes.

7

Re: The macro date selection in a column is less than date system

assei;
Here an example, but bad shot.

8

Re: The macro date selection in a column is less than date system

iMrTidy, I and about  absolutely forgot, so your example approaches, And probably to complicate conditions i.e. if near to this date in an adjacent cell there is a value, then the red

9

Re: The macro date selection in a column is less than date system

assei;
Probably. I like wrote about "" and about an example...