Trying To Code A Dynamic Range of Rows

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
4,564
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I am trying, with the code below, to delete all shapes within a range defined by rows "diaedrow" (=50) and lr (=270) and then delete those rows in that range.
So, any shapes in rows 51:270 delete, and then delete rows 51:270
Rich (BB code):
       With Worksheets("COPY ME").Rows(""" & diaedrow+1 & ":" & lr & """)
            For Each shp In .Parent.Shapes
                If Not Intersect(shp.TopLeftCell, .Cells) Is Nothing Then shp.Delete
            Next shp
            .Delete
        End With

I am having difficulty writing the first line. Thoughts?
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Just get rid of the triple quotes:
VBA Code:
With Worksheets("COPY ME").Rows(diaedrow + 1 & ":" & lr)
 
Upvote 0
Solution

Forum statistics

Threads
1,214,601
Messages
6,120,460
Members
448,965
Latest member
grijken

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top