I am currently making an excel template for other people in company to use. I need to delete rows with a single button. I believe I've done everything correctly, but I am keep getting an error.
Right below you can see the codes which gives error;
Worksheets("Storyboard").Activate
Worksheets("Storyboard").Unprotect Password:="**$#B'A1313XQ.;**"
satirlar = Baslangic & ":" & Bitis
For i = Baslangic To Bitis
Dim s As Shape
For Each s In Worksheets("Storyboard").Shapes
If Not Intersect(s.TopLeftCell, Range("L" & Baslangic & ":" & "L" & Bitis)) Is Nothing Then
s.Delete
End If
Next s
Next i
Rows(satirlar).Delete Shift:=xlUp
I am keep getting an error on the "s.topleftcell" part. It says that "application-defined or object defined error".
On this code; "Baslangic" and "Bitis" are predefined with a form.
I can use any possible advise here..
A data validation (DV) dropdown is a shape, but DV dropdowns don't have a TopLeftCell
property. What you can do is loop through the DrawingObjects
instead:
For i = Baslangic To Bitis
Dim s As Object
For Each s In Worksheets("Storyboard").DrawingObjects
If Not Intersect(s.TopLeftCell, Range("L" & Baslangic & ":" & "L" & Bitis)) Is Nothing Then
s.Delete
End If
Next s
Next i