Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Macro Question
I have a macro written that drops down a line, copies it one to the left,
drops down 2 lines, moves back to the left and copies it back to the right of the previous line. Macro works fine, except, I need to be able to start it from different cells and regardless of where I put my cursor the macro always runs from the cells it was in when I wrote it. How do I adjust it so it starts from wherever the cursor is? -- Dana |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Macro Question
Post the macro to give us something to work on.
-- __________________________________ HTH Bob "ddbro" wrote in message ... I have a macro written that drops down a line, copies it one to the left, drops down 2 lines, moves back to the left and copies it back to the right of the previous line. Macro works fine, except, I need to be able to start it from different cells and regardless of where I put my cursor the macro always runs from the cells it was in when I wrote it. How do I adjust it so it starts from wherever the cursor is? -- Dana |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Macro Question
Range("A26").Select
Selection.Cut Range("B25").Select ActiveSheet.Paste Range("A27").Select Selection.Cut Range("C25").Select ActiveSheet.Paste Range("A28").Select Selection.Cut Range("D25").Select ActiveSheet.Paste End Sub Simple little macro. What I want is the range to be wherever I place my cursor. -- Dana "Bob Phillips" wrote: Post the macro to give us something to work on. -- __________________________________ HTH Bob "ddbro" wrote in message ... I have a macro written that drops down a line, copies it one to the left, drops down 2 lines, moves back to the left and copies it back to the right of the previous line. Macro works fine, except, I need to be able to start it from different cells and regardless of where I put my cursor the macro always runs from the cells it was in when I wrote it. How do I adjust it so it starts from wherever the cursor is? -- Dana |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
Macro Question
Here you go:
Sub moveCells() 'Range("A26").Select ActiveCell.Cut 'Range("B25").Select ActiveCell.Offset(-1, 1).Select ActiveSheet.Paste 'Range("A27").Select ActiveCell.Offset(2, -1).Cut 'Range("C25").Select ActiveCell.Offset(0, 1).Select ActiveSheet.Paste 'Range("A28").Select ActiveCell.Offset(3, -2).Cut 'Range("D25").Select ActiveCell.Offset(0, 1).Select ActiveSheet.Paste Application.CutCopyMode = False End Sub Hope this helps, Jim -- I appreciate any feedback. |
#5
Posted to microsoft.public.excel.misc
|
|||
|
|||
Macro Question
The first post was if you wanted to cut and paste the values, but if you just
want to copy them, you simply need to copy, paste-special transpose the cells! In that case, here you go: Sub CopyPasteSpecial() Range(ActiveCell, ActiveCell.Offset(2, 0)).Copy ActiveCell.Offset(-1, 1).PasteSpecial Paste:=xlPasteAll, _ Operation:=xlNone, SkipBlanks:=False, Transpose:=True Application.CutCopyMode = False End Sub Hope this helps, Jim -- I appreciate any feedback. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro Question | Excel Discussion (Misc queries) | |||
Macro question | Excel Worksheet Functions | |||
Macro Question | Excel Worksheet Functions | |||
Macro Question | Excel Worksheet Functions | |||
Macro Question? | Excel Discussion (Misc queries) |