#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,420
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 42
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 42
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro Question McCloudK Excel Discussion (Misc queries) 7 September 14th 07 09:41 PM
Macro question John Excel Worksheet Functions 7 October 19th 06 04:48 PM
Macro Question carl Excel Worksheet Functions 0 June 8th 06 03:37 PM
Macro Question sony654 Excel Worksheet Functions 3 February 27th 06 09:55 PM
Macro Question? Greg B Excel Discussion (Misc queries) 7 March 9th 05 01:08 PM


All times are GMT +1. The time now is 08:29 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"