ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Help with Code (https://www.excelbanter.com/excel-discussion-misc-queries/60591-help-code.html)

aftamath

Help with Code
 
A little help, please. I keep getting a "Type Mismatch" error. Column I is
formatted as Date.

Private Sub Workbook_Open()

Dim cell As Range

Application.Worksheets(5).Activate

Set rngLate = Range("I2:I65535")
For Each cell In rngLate

If cell.Value < "" And (cell.Value - Date) <= 2 And cell.Offset(,
-1).Value = "" Then
MsgBox "Order Due" & " " & cell.Offset(, -7).Value & Chr(10) &
cell.Value
End If

Next cell

Application.Worksheets(4).Activate


End Sub

Gary''s Student

Help with Code
 
Make sure that all cell.Value are numeric
--
Gary's Student


"aftamath" wrote:

A little help, please. I keep getting a "Type Mismatch" error. Column I is
formatted as Date.

Private Sub Workbook_Open()

Dim cell As Range

Application.Worksheets(5).Activate

Set rngLate = Range("I2:I65535")
For Each cell In rngLate

If cell.Value < "" And (cell.Value - Date) <= 2 And cell.Offset(,
-1).Value = "" Then
MsgBox "Order Due" & " " & cell.Offset(, -7).Value & Chr(10) &
cell.Value
End If

Next cell

Application.Worksheets(4).Activate


End Sub



All times are GMT +1. The time now is 05:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com