Beneindias
Board Regular
- Joined
- Jun 21, 2022
- Messages
- 120
- Office Version
- 365
- Platform
- Windows
- MacOS
Hi guys.
I'm a noob working with VBA, so I need your help.
So, I have an excel file, where I have a table with some data.
In this table, I have a collumn named "expiration date" (column G), but not all rows have expiration dates, some of them are empty.
I have setup a conditional formating, that compares expiration date with current date and changes colors of the entire row.
But, I need something better:
I need to have a Warning message to pop when I open the file, to tell me that I have some product that as passed the expiration date.
This VBA code needs to ignore empty cells and cells with text in that collumn.
This is in a table, so it would be awesome if it would work when rows are added to the table.
I only want the warning if I have some product that has passed the date.
Tried the next script, but it gave me an error "Compile error: Sub or Function not defined.":
Private Sub Workbook_Open()
If Worksheets("Folha1").Range("$G9").Value < TODAY() Then
MsgBox "Tem declarações expiradas", vbOKOnly
End If
End Sub
Is my script bad, or am I doing something wrong?
Apreciate all your help.
I'm a noob working with VBA, so I need your help.
So, I have an excel file, where I have a table with some data.
In this table, I have a collumn named "expiration date" (column G), but not all rows have expiration dates, some of them are empty.
I have setup a conditional formating, that compares expiration date with current date and changes colors of the entire row.
But, I need something better:
I need to have a Warning message to pop when I open the file, to tell me that I have some product that as passed the expiration date.
This VBA code needs to ignore empty cells and cells with text in that collumn.
This is in a table, so it would be awesome if it would work when rows are added to the table.
I only want the warning if I have some product that has passed the date.
Tried the next script, but it gave me an error "Compile error: Sub or Function not defined.":
Private Sub Workbook_Open()
If Worksheets("Folha1").Range("$G9").Value < TODAY() Then
MsgBox "Tem declarações expiradas", vbOKOnly
End If
End Sub
Is my script bad, or am I doing something wrong?
Apreciate all your help.