Need coding to DELETE a line on a spreadsheet.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

With Worksheets("SpeedPlay").Shapes.AddLine(546, 90, 546, 114)
..Line.ForeColor.RGB = RGB(0, 0, 0)
End With

The preceding Macro code adds a black line of a certain length and in a
certain place on a spreadsheet named SpeedPlay.

What I need is the coding to DELETE (remove) this same line.
Is that possible?

Thankyou
Ed
 
Ed,

Give the line a name,

With Worksheets("SpeedPlay").Shapes.AddLine(546, 90, 546, 114)
..Line.ForeColor.RGB = RGB(0, 0, 0)
..Name = "TheLine"
End With

Then, reference the line via the Shapes collection and delete it.

Worksheets("SpeedPlay").Shapes("TheLine").Delete


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top