PDA

View Full Version : Macros in Excel ...... ?


Oggin Aviator
27th Jan 2007, 12:05
Hi

Can someone explain how to design and put a macro in excel that can help automatically draw arrows of specific lengths and fill colours?

TIA

Oggin

Glen Livid
23rd Feb 2007, 00:15
Go to Menu: Tools/Macro/Record New Macro and draw sample arrows and then format as required, then stop macro recording.

Press Alt + F8 (or Menu: Tools/Macro/Macros) and choose Edit and you will see the macro you have just recorded. You can edit the macro's AddLine Method to change the arrows as required. When you want to run the modified macro you can hit Alt + F8, select the macro and choose Run. You could also assign the macro to a button on your worksheet or to a new toolbar or menu command.

AddLine Method Example:
This example adds a blue dashed line to myDocument.
Set myDocument = Worksheets(1)
With myDocument.Shapes.AddLine(10, 10, 250, 250).Line
.DashStyle = msoLineDashDotDot
.ForeColor.RGB = RGB(50, 0, 128)
End With