Hi all,
I have some code that I am using to import data from scripting dictionary array items.
I am trying to get it to ignore items that have a date older than one year but it does not seem to like the code. I'm not sure why and wondering if anyone can help.
Below is a small excerpt of some of the code
I know it's the bit that has And
that's giving me the trouble but I'm not sure why.
.Item(Ky)(5) is my date value
Any help appreciated,
Many thanks
Tom
I have some code that I am using to import data from scripting dictionary array items.
I am trying to get it to ignore items that have a date older than one year but it does not seem to like the code. I'm not sure why and wondering if anyone can help.
Below is a small excerpt of some of the code
Code:
NxtRw = Ws1.Range("A" & Rows.Count).End(xlUp).Offset(1).Row For Each Ky In .keys
If .Item(Ky)(3) <> "CAN" And .Item(Ky)(3) <> "COMP" And .Item(Ky)(5).Value < (Date + 365) Then
Ws1.Range("A" & NxtRw).Value = Ky
Ws1.Range("A" & NxtRw).Interior.Color = rgbYellow
Ws1.Range("B" & NxtRw).Value = .Item(Ky)(0)
On Error Resume Next
Ws1.Range("B" & NxtRw).ClearComments
On Error GoTo 90
If .Item(Ky)(6) <> "" Then
Ws1.Range("B" & NxtRw).AddComment
Ws1.Range("B" & NxtRw).Comment.Text Text:=.Item(Ky)(6)
Ws1.Range("B" & NxtRw).Comment.Shape.TextFrame.AutoSize = True
If Ws1.Range("B" & NxtRw).Comment.Shape.Width > 200 Then
I know it's the bit that has And
Code:
And .Item(Ky)(5).Value < (Date + 365) Then
.Item(Ky)(5) is my date value
Any help appreciated,
Many thanks
Tom