Hello,
I have never used VBA and have been given a task to create an active button in an Excel worksheet that adds a new row to the end of the data set. It also needs to copy down any formatting/dropdown selections or formulas contained in the cells above. I am not sure if this makes any sense?
There is a form already in place that someone with more skills than me created so I have some coding but it does not seem to be working quite right. I am not going to lie this is like a whole new language to me and I am struggling. Any help much apricated .
This is the code I found:
Sub NewRecord()
On Error Resume Next
Application.ScreenUpdating = False
ActiveSheet.Unprotect
ActiveSheet.ShowAllData
Range("LACData[[#Headers],[Fwi]]").Select
Selection.End(xlDown).Select
Selection.Offset(1, 17).Select
ActiveCell.FormulaR1C1 = "No"
ActiveSheet.Protect , DrawingObjects:=False, _
Contents:=True, Scenarios:=False, _
AllowFormattingCells:=True, AllowFormattingColumns:=True, _
AllowFormattingRows:=True, AllowInsertingColumns:=True, _
AllowInsertingRows:=True, AllowInsertingHyperlinks:=True, _
AllowDeletingColumns:=True, AllowDeletingRows:=True, _
AllowSorting:=True, AllowFiltering:=True, _
AllowUsingPivotTables:=True
Application.ScreenUpdating = True
End Sub
I have never used VBA and have been given a task to create an active button in an Excel worksheet that adds a new row to the end of the data set. It also needs to copy down any formatting/dropdown selections or formulas contained in the cells above. I am not sure if this makes any sense?
There is a form already in place that someone with more skills than me created so I have some coding but it does not seem to be working quite right. I am not going to lie this is like a whole new language to me and I am struggling. Any help much apricated .
This is the code I found:
Sub NewRecord()
On Error Resume Next
Application.ScreenUpdating = False
ActiveSheet.Unprotect
ActiveSheet.ShowAllData
Range("LACData[[#Headers],[Fwi]]").Select
Selection.End(xlDown).Select
Selection.Offset(1, 17).Select
ActiveCell.FormulaR1C1 = "No"
ActiveSheet.Protect , DrawingObjects:=False, _
Contents:=True, Scenarios:=False, _
AllowFormattingCells:=True, AllowFormattingColumns:=True, _
AllowFormattingRows:=True, AllowInsertingColumns:=True, _
AllowInsertingRows:=True, AllowInsertingHyperlinks:=True, _
AllowDeletingColumns:=True, AllowDeletingRows:=True, _
AllowSorting:=True, AllowFiltering:=True, _
AllowUsingPivotTables:=True
Application.ScreenUpdating = True
End Sub