close

When I create Excel macros that cause borders to be set or macros that
include drawings, they only run where they were created. I need to have them
run at the point the cursor is at when I execute the macro. In other words,
they need to run other places in the worksheet, not just at the cells they
were created. How can I do this?

If you a recording a macro just click on the Relative Reference button
on the Stop Recording toolbar.

quot; wrote:

gt; If you a recording a macro just click on the Relative Reference button
gt; on the Stop Recording toolbar.
gt;
gt; Your suggestion works for borders and I should have remembered to do that from past use of macros. Thanks because that does help me. Drawing elements still revert to where they were drawn, can macros be created using drawing elements so they too are relative to the cursor cell? Thanks.
Dan

Something like this might work.

Sub Macro3()

iTop = ActiveCell.Top
iLeft = ActiveCell.Left

ActiveSheet.Shapes.AddShape msoShapeRectangle, iLeft, iTop, 219#,
93#

End Sub

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()