?
Solved

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

Posted on 2003-02-21
7
Medium Priority
?
240 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This article describes a serious pitfall that can happen when deleting shapes using VBA.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
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: …

752 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