ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro Help (https://www.excelbanter.com/excel-programming/383374-macro-help.html)

Janna

Macro Help
 
I'd like to be able to place my cursor in a cell and run a macro that selects
that cell, plus 2 additional cells to the right (in the same row) and move
all three cells up one row. (basically a cut and paste).

Easily possible???

Greg Wilson

Macro Help
 
Below are two options. The first only transfers values (ignores formatting)
and clears the contents of the source range. The second option does a cut and
paste (includes formatting).

Option 1:-

Sub XXX()
With ActiveCell.Resize(1, 3)
.Offset(-1).Value = .Value
.ClearContents
End With
End Sub

Option 2:-

Sub YYY()
With ActiveCell
.Resize(1, 3).Cut .Offset(-1)
End With
End Sub

Regards,
Greg


All times are GMT +1. The time now is 10:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com