Hi, I am new to VBA and macros, is it possible some one can assist me with writing a mini code to copy A1, B1, C1, into next row, but do a selection auto fill meaning increment the numbers, instead of just plain copy and paste.
I have a button on the last row of the table and I also want it to detect the current row, and do an insert first, then do the copy and paste with increment.
Sub InserRow()
With ActiveSheet.Buttons(1) 'Form Control
Range(.TopLeftCell, .BottomRightCell).EntireRow.Select
End With
' Insert blank row.
ActiveCell.EntireRow.Insert shift:=xlDown
'Move up one row.
ActiveCell.Offset(-1, 0).Select
Selection.Copy
ActiveCell.Offset(1, 0).Select
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveCell.Offset(-1, 1).Select
Selection.Copy
ActiveCell.Offset(1, 0).Select
ActiveSheet.Paste
' Selection.AutoFill Destination:=Range(ActiveCell.Offset(0, 0)), Type:=xlFillDefault
' Selection.AutoFill Destination:=ActiveCell.Resize(ActiveCell.Offset(0, -1).Value, 1), Type:=xlFillDefault
Application.CutCopyMode = False
Can anyone help with the selection syntax or if possible with another function, then help please.
Thanks.
I have a button on the last row of the table and I also want it to detect the current row, and do an insert first, then do the copy and paste with increment.
Sub InserRow()
With ActiveSheet.Buttons(1) 'Form Control
Range(.TopLeftCell, .BottomRightCell).EntireRow.Select
End With
' Insert blank row.
ActiveCell.EntireRow.Insert shift:=xlDown
'Move up one row.
ActiveCell.Offset(-1, 0).Select
Selection.Copy
ActiveCell.Offset(1, 0).Select
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveCell.Offset(-1, 1).Select
Selection.Copy
ActiveCell.Offset(1, 0).Select
ActiveSheet.Paste
' Selection.AutoFill Destination:=Range(ActiveCell.Offset(0, 0)), Type:=xlFillDefault
' Selection.AutoFill Destination:=ActiveCell.Resize(ActiveCell.Offset(0, -1).Value, 1), Type:=xlFillDefault
Application.CutCopyMode = False
Can anyone help with the selection syntax or if possible with another function, then help please.
Thanks.