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

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Just get rid of the triple quotes:
VBA Code:
With Worksheets("COPY ME").Rows(diaedrow + 1 & ":" & lr)
 
Upvote 0
Solution

Forum statistics

Threads
1,215,334
Messages
6,124,321
Members
449,154
Latest member
pollardxlsm

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