Macros in Excel ...... ?
Thread Starter
Join Date: Dec 2000
Location: Red Red Back to Bed
Posts: 541
Likes: 0
Received 0 Likes
on
0 Posts
Macros in Excel ...... ?
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
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
Join Date: Mar 2002
Location: UK
Age: 62
Posts: 6
Likes: 0
Received 0 Likes
on
0 Posts
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
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