Teroy - Thank you for the solution again. I now need to lock selected cells and protect the worksheet.
I unlocked the cells the user may enter data into and locked cells they may not change. I saved it as a macro enabled worksheet. Then I protected the worksheet with the "select ulocked cells" toggled on in the "allow all users of this worksheet to:" section. The Proitect worksheet and contects of locked cells is toggled on. After saving the worksheet again, and changing the date (the event that triggers the macro), I received a "Run time error 1004: PasteSpecila methd of Range class failed" error.
The Debug highlighted Range("A3").PasteSpecial xlPasteValues.
Here is the Code I used for the worksheet included in this post:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then
Range("D3:D" & Range("C" & Rows.Count).End(xlUp).Row).Copy
Range("A3").PasteSpecial xlPasteValues
Range("B3:B" & Range("B" & Rows.Count).End(xlUp).Row).Value = 0
Range("C3:C" & Range("C" & Rows.Count).End(xlUp).Row).Value = 0
Application.CutCopyMode = False
End If
End Sub
The user may change A1, B3-B7, C3-C7. The rest of the cells are locked. When the user changes the date in A1, it triggers the macro.
Sheet1
*
| A
| B
| C
| D
| E
| F
| G
|
1
| 3/32/2013
| *
| *
| *
| *
| *
| *
|
2
| Last Week's Enrollment
| New This week
| Withdrawn
| Total Enrollment
| *
| *
| Last Week's Enrollment
|
3
| 49
| 5
| 1
| 53
| *
| *
| 49
|
4
| 61
| 5
| 1
| 65
| *
| *
| 61
|
5
| 67
| 5
| 1
| 71
| *
| *
| 67
|
6
| 75
| 5
| 1
| 79
| *
| *
| 75
|
7
| 72
| 5
| 1
| 76
| *
| *
| 72
|
8
| *
| *
| *
| *
| *
| *
| *
|
9
| save as macro-enabled worksheet
| | | | | | |
<TBODY>
</TBODY>
Spreadsheet Formulas
|
Cell
| Formula
| D3
| =SUM(A3+B3)-C3
| G3
| =A3
| D4
| =SUM(A4+B4)-C4
| G4
| =A4
| D5
| =SUM(A5+B5)-C5
| G5
| =A5
| D6
| =SUM(A6+B6)-C6
| G6
| =A6
| D7
| =SUM(A7+B7)-C7
| G7
| =A7
|
<TBODY>
</TBODY> |
<TBODY>
</TBODY>
Thank you for looking at this.
Excel tables to the web >> Excel Jeanie Html" target="_blank"> Excel Jeanie HTML 4