azizrasul
Well-known Member
- Joined
- Jul 7, 2003
- Messages
- 1,304
- Office Version
- 365
- 2019
- 2016
- Platform
- Windows
I have the following code, where I get the error (Application-defined or object-defined error) on the line
ActiveSheet.Range(Cells(6, z), Cells(10, z)).Select. What am I doing wrong?
ActiveSheet.Range(Cells(6, z), Cells(10, z)).Select. What am I doing wrong?
Code:
For Each rng In Range("DateRange")
If strDateRange <> rng.Value Then
strDateRange = rng.Value
Cells(8, 8 + x).Value = rng.Value
Range(Cells(8, 8 + x), Cells(8, 9 + x)).Select
Selection.Merge
Selection.HorizontalAlignment = -4108
Selection.Font.Bold = True
Cells(9, 8 + x).Value = "Baseline"
Cells(10, 8 + x).Value = "Actual"
Cells(10, 9 + x).Value = "Target"
Sheets("TARGETS").Select
ActiveSheet.Cells(5, 3).Select
For z = 3 To 12
If ActiveSheet.Cells(5, z) = rng.Value Then
ActiveSheet.Range(Cells(6, z), Cells(10, z)).Select
Selection.Copy
Sheets("KEY PERFORMANCE INDICATORS").Select
Cells(11, 9 + x).Select
ActiveSheet.Paste
Exit For
End If
Next z
x = x + 2
End If
Next rng