Move cell contents with macro

P

Peridot

I need to create a macro that will take the contents of a cell and move them
one column over and one cell up. The macro I made keeps putting any new move
in the same cell. It should take the contents of D3 and put them in C2, then
put the contents of D5 and put them in C4. My macro puts everything in C2, no
matter where I start. I'd appreciate anyhelp. Thanks!
 
P

Per Jessen

As always, post your macro for comments.

Maybe something like:

ActiveCell.Offset(-1,-1)=ActiveCell.Value

Regards.
Per
 
L

Luke M

You can create a relative reference using Offset

ActiveCell.Offset(-1,1).Value = ActiveCell.Value
ActiveCell.ClearContents
 
J

Jim Thomlinson

try this... Note that it will not be happy if your active cell is in Column A
or on row 1 as it will be trying to acess cells that don't exist.

sub MoveStuff()
Activecell.offset(-1, -1).value = activecell.value
end sub
 
L

Luke M

Oops, forgot the 2nd negative symbol

ActiveCell.Offset(-1,-1).Value = ActiveCell.Value
ActiveCell.ClearContents
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top