ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Date problems (https://www.excelbanter.com/excel-programming/387345-date-problems.html)

edluver

Date problems
 
I am trying to get this simple code to work. Basically, i want to set this
up so that if it has been less than 30 days between dates it will return a
value. This is the code:

OpenDate = CDate(TransAmount.Offset(0, -4))
TodayDate = CDate(TransAmount.Offset(0, 12))
If TransAmount.Offset(0, -2) = "C" And DateDiff("d", TodayDate,
OpenDate) <= 32 And TransAmount = 750 Then
TransAmount.EntireRow.Select
Selection.Font.Bold = True
With Selection.Interior
.ColorIndex = 37
.Pattern = xlSolid
End With
TransAmount.Offset(0, -7).Select
ActiveCell.Value = "HOLD"
End If

i keep getting an "object needed" error. Any ideas?


Tyla

Date problems
 
What line of code is highlighted when the error occurs? Is
"TransAmount" always initialized properly?

/ Tyla /


On Apr 12, 5:50 pm, edluver wrote:
I am trying to get this simple code to work. Basically, i want to set this
up so that if it has been less than 30 days between dates it will return a
value. This is the code:

OpenDate = CDate(TransAmount.Offset(0, -4))
TodayDate = CDate(TransAmount.Offset(0, 12))
If TransAmount.Offset(0, -2) = "C" And DateDiff("d", TodayDate,
OpenDate) <= 32 And TransAmount = 750 Then
TransAmount.EntireRow.Select
Selection.Font.Bold = True
With Selection.Interior
.ColorIndex = 37
.Pattern = xlSolid
End With
TransAmount.Offset(0, -7).Select
ActiveCell.Value = "HOLD"
End If

i keep getting an "object needed" error. Any ideas?




Barb Reinhardt

Date problems
 
Do you have
Dim TransAmount as Range

???

"edluver" wrote:

I am trying to get this simple code to work. Basically, i want to set this
up so that if it has been less than 30 days between dates it will return a
value. This is the code:

OpenDate = CDate(TransAmount.Offset(0, -4))
TodayDate = CDate(TransAmount.Offset(0, 12))
If TransAmount.Offset(0, -2) = "C" And DateDiff("d", TodayDate,
OpenDate) <= 32 And TransAmount = 750 Then
TransAmount.EntireRow.Select
Selection.Font.Bold = True
With Selection.Interior
.ColorIndex = 37
.Pattern = xlSolid
End With
TransAmount.Offset(0, -7).Select
ActiveCell.Value = "HOLD"
End If

i keep getting an "object needed" error. Any ideas?



All times are GMT +1. The time now is 09:38 PM.

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