![]() |
Newbie - Move Selection one cell to right
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 ------------------- Selection.Cut Selection.Offset(0, 1).Select Selection.PasteSpecial xlPasteValues ------------------- Any ideas? Thanks in advance for your help! -Dann -- Message posted from http://www.ExcelForum.com |
Newbie - Move Selection one cell to right
selection.offset(0,1).value = selection.value
perhaps? -- Return email address is not as DEEP as it appears "dpolkinhorn " wrote in message ... Hi, I need to move the values in a selection one cell to the right. The selection is not limited one one row or column and I don't want to move 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 with Cut: Code: -------------------- Selection.Cut Selection.Offset(0, 1).Select Selection.PasteSpecial xlPasteValues -------------------- Any ideas? Thanks in advance for your help! -Danny --- Message posted from http://www.ExcelForum.com/ |
Newbie - Move Selection one cell to right
Oops
and to that perhaps add the line selection.clearcontents -- Return email address is not as DEEP as it appears "Jack Schitt" wrote in message ... selection.offset(0,1).value = selection.value perhaps? -- Return email address is not as DEEP as it appears "dpolkinhorn " wrote in message ... Hi, I need to move the values in a selection one cell to the right. The selection is not limited one one row or column and I don't want to move 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 with Cut: Code: -------------------- Selection.Cut Selection.Offset(0, 1).Select Selection.PasteSpecial xlPasteValues -------------------- Any ideas? Thanks in advance for your help! -Danny --- Message posted from http://www.ExcelForum.com/ |
Newbie - Move Selection one cell to right
Ok, as the selection can be more than one column wide:
Selection.Offset(0, 1).Value = Selection.Value Selection.Resize(, 1).ClearContents -- Return email address is not as DEEP as it appears "dpolkinhorn " wrote in message ... 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 9 -------------------- you would get this: Code: -------------------- A B C D 1 5 4 2 3 9 -------------------- Thanks again for your help! -Danny --- Message posted from http://www.ExcelForum.com/ |
Newbie - Move Selection one cell to right
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 -- Message posted from http://www.ExcelForum.com |
All times are GMT +1. The time now is 04:44 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com