?
Solved

Excel - macro/code to delete and change line style of drawing objects

Posted on 2003-02-21
7
Medium Priority
?
242 Views
Last Modified: 2006-11-17
Hi experts,

I was hoping someone could tell me how I can automatically delete some drawing objects (lines) and then change the line style of others.

Here is the scenerio.....I have approximately 100 spreadsheets, each has 12 columns.  These spreadsheets are generated from Oracle ADI...they are financial statements.  The "double line" that is in the spreadsheet is not printing very well as it is too squished together.  I have tried several different printers to try to remedy this but the results are the same.  I have - found that all the lines in these sheets are single line drawing objects, some just close together to make it look like a double line.  

I would like a little routine that would do the following:

- Delete lines 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96
- Then change the format of the following lines from 3/4 point single to 3 point double  73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95

Hopefully someone can help me with this.  Anything would be really appreciated!!!

Thanks in advance,
Connie
0
Comment
Question by:Catt999
  • 4
  • 3
7 Comments
 
LVL 1

Expert Comment

by:yairsuari
ID: 7994795
put that in a macro seems like its going to help you


For i = 1 To 12

a = i * 2 + 72
   
    ActiveSheet.Shapes("Line" & a).Select
    Selection.Delete
Next i

For i = 1 To 12
a = i + 3
    ActiveSheet.Shapes("Line" & a).Select
    Selection.ShapeRange.Line.Style = ********
Next a

0
 
LVL 1

Expert Comment

by:yairsuari
ID: 7994825
if i understand correctly that is what you want for the lines that are left on the screen

For i = 1 To 12

a = i * 2 + 72
   
   ActiveSheet.Shapes("Line" & a).Select
   Selection.Delete
Next i

For i = 1 To 12
a = i + 3
   ActiveSheet.Shapes("Line" & a).Select
   Selection.ShapeRange.Line.Weight = 2#

Next a

0
 

Author Comment

by:Catt999
ID: 7994893
vairsuari,

Thanks so much.  I think you have a grasp on what I want to do.  I have tried your suggestion but am having problems with the second Next statement.

When I run the macro I get a message "Invalid next control variable reference" and it is showing as not liking the "a" in "next a".  I tried changing this to "next i" but then received error "system error &H80070057 (-2147024809)"  I clicked on Help but it gave me nothing.  Ideas?

Connie
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:yairsuari
ID: 7996193
For i = 1 To 12

a = i * 2 + 72

   ActiveSheet.Shapes("Line " & a).Select
  Selection.Delete
Next i

For i = 1 To 12
a = i + 3
    ActiveSheet.Shapes("Line " & a).Select
    Selection.ShapeRange.Line.Weight = 2#


Next i

and now?

if you saved the sheet after runing my first one i may have got you in trouble so please try it and save your sheet only if it works
0
 
LVL 1

Accepted Solution

by:
yairsuari earned 400 total points
ID: 7998976
this is not my code every time i look at it i see i forgot something
the 3 in the second a calculation should be 73
a = i * 2 + 72

  ActiveSheet.Shapes("Line " & a).Select
 Selection.Delete
Next i

For i = 1 To 12
a = i + 73
   ActiveSheet.Shapes("Line " & a).Select
   Selection.ShapeRange.Line.Weight = 2#


Next i

0
 

Author Comment

by:Catt999
ID: 8008835
yairsuari,

Thanks so much!!  I have it working but I cannot figure out how to change the line from single to double.  I have been looking in help but have not found anything yet.  Suggestions??

Connie
0
 

Author Comment

by:Catt999
ID: 8018759
Hi,

I have managed to get the double lines to work by recording a macro while selecting and changing the style and then using that code.

Thanks for all your help!!!

Connie
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is an article on how to answer questions, earn points and become an expert.
MS Outlook undoubtedly is the most widely used email client.Its user-friendliness, cost effectiveness, and availability with Microsoft Office Suite make it the most popular email application.  Its compatibility with Microsoft applications like Exch…
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question