简体   繁体   中英

VBA Excel Copying Cell contents to another via column and row offset

Here is my code

Sub A_Copy_To_Prior_Row_column()
'
' A_Copy_To_Prior_Row_column Macro
'

'
    Application.CutCopyMode = False
    Selection.Copy
    Range("R183").Select
    ActiveSheet.Paste
End Sub

Where R183 is I need to not a specific cell, but a cell based on minus 1 row, and +17 columns of the selected/highlighted cell I wish to copy

activecell.Offset(-1, 17).Value = activecell.Value
Sub A_Copy_To_Prior_Row_column()
'
' A_Copy_To_Prior_Row_column Macro
'

'
    Application.CutCopyMode = False
    With Selection
        .Copy
         ActiveSheet.Paste Destination:=.Offset(-1, 17)
    End With
End Sub

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM