Newbie - Move Selection one cell to right

D

dpolkinhorn

Hi,

I need to move the values in a selection one cell to the right. Th
selection is not limited one one row or column and I don't want to mov
the formatting. I tried this (which as pseudo-code does what I want
but it gives an error because the PasteSpecial method doesn't work wit
Cut:

Code
 
J

Jack Schitt

Oops
and to that perhaps add the line
selection.clearcontents

--
Return email address is not as DEEP as it appears
Jack Schitt said:
selection.offset(0,1).value = selection.value
perhaps?
 
D

dpolkinhorn

Jack,

Thanks for the reply. Actually that just seems to copy the cells.
Here's another example. If you select B1:C2 then run the macro,

Code
-------------------

A B C D
1 5 4
2 3
-------------------

you would get this:

Code
-------------------

A B C D
1 5 4
2 3
-------------------


Thanks again for your help!

-Dann
 
J

Jack Schitt

Ok, as the selection can be more than one column wide:

Selection.Offset(0, 1).Value = Selection.Value
Selection.Resize(, 1).ClearContents
 
D

dpolkinhorn

Jack,

That's exactly what I needed, thanks!

btw, I added the line:
Selection.Offset(0,1).Select
to also move the selection.

Thanks again for your help!
-Dann
 
Top