Good morning
The below list formula copies contents from specific cells from one worksheet to another. The problem is cell "A21" has a formula (=year(Now()) so when the cells are copied it copies the formula rather than the cell content.
Any help appreciated and thank you.
Sub EnterInfo()
'
' EnterInfo Macro
'
' Keyboard Shortcut: Ctrl+z
'
ActiveSheet.Unprotect
Range("A21").Select
Dim FromRng As Range
Dim ToRng As Range
With Worksheets("Data Entry Sheet")
Set FromRng = .Range("A21:L21")
End With
With Worksheets("Activity")
Set ToRng = .Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0)
End With
FromRng.Copy _
Destination:=ToRng
With Worksheets("Data Entry Sheet")
Set FromRng = .Range("B21:L21")
FromRng.ClearContents
Range("B21").Select
End With
Range("A21").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFormattingCells:=True
ActiveSheet.Unprotect
Range("B21").Select
Selection.Locked = False
Selection.FormulaHidden = False
Range("B21").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFormattingCells:=True
End Sub
The below list formula copies contents from specific cells from one worksheet to another. The problem is cell "A21" has a formula (=year(Now()) so when the cells are copied it copies the formula rather than the cell content.
Any help appreciated and thank you.
Sub EnterInfo()
'
' EnterInfo Macro
'
' Keyboard Shortcut: Ctrl+z
'
ActiveSheet.Unprotect
Range("A21").Select
Dim FromRng As Range
Dim ToRng As Range
With Worksheets("Data Entry Sheet")
Set FromRng = .Range("A21:L21")
End With
With Worksheets("Activity")
Set ToRng = .Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0)
End With
FromRng.Copy _
Destination:=ToRng
With Worksheets("Data Entry Sheet")
Set FromRng = .Range("B21:L21")
FromRng.ClearContents
Range("B21").Select
End With
Range("A21").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFormattingCells:=True
ActiveSheet.Unprotect
Range("B21").Select
Selection.Locked = False
Selection.FormulaHidden = False
Range("B21").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFormattingCells:=True
End Sub