I have run this code before without problems, but now I am getting an error. Something about the object doesn't like the property.
The bold text is when the error occurs.
The bold text is when the error occurs.
Code:
'Open and set up data monthly sheet
Workbooks.Open ("P:\STATE REVIEWS\OH\OH\New Product Set Up\Property\Profile Exhibits\Outputs\" & dYear & dMonth & dDay & " Quotes - M.xls")
Sheets(1).Name = "Sheet2"
Sheets.Add before:=Sheets(1)
Sheets(2).Range("D:D").AdvancedFilter Action:=xlFilterInPlace, Unique:=True
Sheets(2).Columns("E").Copy Sheets(1).Range("A1")
Sheets(2).Columns("AJ").Copy Sheets(1).Range("B1")
Sheets(2).ShowAllData
Set Quotes_M = Workbooks(dYear & dMonth & dDay & " Quotes - M.xls")
P_Profile.Sheets(4).Range("A4:GL65500").ClearContents
'Filter and paste policy data from data sheet to profile tab
With Quotes_M.Sheets(2)
.Range("E:E").AdvancedFilter Action:=xlFilterInPlace, Unique:=True
.Range("F2:H2", .Range("F2:H2").End(xlDown)).Copy P_Profile.Sheets(4).Range("B3")
.Range("I2:M2", .Range("I2:M2").End(xlDown)).Copy P_Profile.Sheets(4).Range("F3")
.Range("S2:X2", .Range("S2:X2").End(xlDown)).Copy P_Profile.Sheets(4).Range("N3")
.Range("AA2:AG2", .Range("AA2:AG2").End(xlDown)).Copy P_Profile.Sheets(4).Range("Z3")
.Range("AH2", .Range("AH2").End(xlDown)).Copy P_Profile.Sheets(4).Range("AH3")
.Range("AI2", .Range("AI2").End(xlDown)).Copy P_Profile.Sheets(4).Range("AY3")
End With
'Copy down formulas in profile tab
With P_Profile.Sheets(4)
.Activate
.Range("B1").FormulaR1C1 = "=COUNTA(R[3]C:R[65535]C)"
Calculate
count2 = .Range("B1").Value
.Range("A3").AutoFill Destination:=Range(.Cells(3, 1), .Cells(count2 + 3, 1))
.Range("E3").AutoFill Destination:=Range(.Cells(3, 5), .Cells(count2 + 3, 5))
End With
'Show all data from data tab
Quotes_M.Sheets(2).ShowAllData
P_Profile.Sheets(4).Activate
'Paste Formula's into profile data sheet
RepNum = 4
Call Formula_Paste
'Copy sales to quotes tab
With P_Profile
.Sheets(5).Activate
[b].Sheets(5).Range(.Cells(3, 1), .Cells(count1 + 3, 52)).Copy[/b]
.Sheets(4).Select
.Sheets(4).Cells(count2 + 4, 1).Select
End With