ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Object required error (https://www.excelbanter.com/excel-programming/420280-object-required-error.html)

Brad

Object required error
 
Below is my macro - why am I getting an object required error?

Sub HolidaySelection()
Dim i As Long
Dim j As Long
Range("startpoint").Select
For i = 1 To 12
For j = 1 To 28
If
Application.WorksheetFunction.CountIf(Worksheets(" Holidays").Range("F5:F13").Value, DateSerial(Range("VacYear").Value, i, j)) Then
ActiveCell.Offset(i, j) = "H"
End If
Next j
Next i
End Sub


Brad

Object required error
 
Removing the .value and it works (not sure why..)
--
Wag more, bark less


"Brad" wrote:

Below is my macro - why am I getting an object required error?

Sub HolidaySelection()
Dim i As Long
Dim j As Long
Range("startpoint").Select
For i = 1 To 12
For j = 1 To 28
If
Application.WorksheetFunction.CountIf(Worksheets(" Holidays").Range("F5:F13").Value, DateSerial(Range("VacYear").Value, i, j)) Then
ActiveCell.Offset(i, j) = "H"
End If
Next j
Next i
End Sub



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

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