Hi All,
I want to add code to an existing macro to account for locked/unlocked cells. In the sheet below, I want to only keep the manila colored cells with blue text as unlocked cells - everything else should be locked. My code breaks as soon as I lock/unlock cells. I've also attached the current code for reference. Thanks in advance!!
I want to add code to an existing macro to account for locked/unlocked cells. In the sheet below, I want to only keep the manila colored cells with blue text as unlocked cells - everything else should be locked. My code breaks as soon as I lock/unlock cells. I've also attached the current code for reference. Thanks in advance!!
Finance Assessment Template_as of 6.20.23 V3.xlsm | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | K | L | |||
1 | Cash Outflow Streams | Select from Dropdown: | Notes: | |||||||||||
2 | Capitalized Expenses (CapEx) à | CapEx | Project will incur Capitalized Expense | |||||||||||
3 | Operating Expenses (OpEx) à | OpEx | Project will incur Operating Expense | |||||||||||
4 | Post Project Operating Expenses (OpEx) à | Post Project OpEx | As result of the project will incur incremental OpEx after the project concludes | |||||||||||
6 | Direct | Direct - Post Project OpEx | ||||||||||||
7 | Indirect | Indirect - Post Project OpEx | ||||||||||||
8 | Contingent / Consultant Costs à | Contingent / Consultant Costs | Contingent and Consultant Costs: The project will require contingent and/or consultant resources | |||||||||||
9 | Internal Labor Costs à | Internal Labor Costs | The project will require internal employee resources or dedicated time from existing and/or new employees to implement and/or upkeep | |||||||||||
11 | Based on Hours Entry | Based on Hours Entry | ||||||||||||
12 | Estimated Salary | Estimated Salary | ||||||||||||
13 | Open Entry | Open Entry | ||||||||||||
14 | ||||||||||||||
15 | Incremental Cash Outflows | |||||||||||||
16 | ||||||||||||||
18 | Investment Cash Flows (Capatalized) | Cash Flow Characteristics | 2023 - Q1 | 2023 - Q2 | 2023 - Q3 | 2023 - Q4 | 2024 | 2025 | 2026 | 2027 | CapEx Categorization | |||
19 | Cash Flow Types | Division/Project Booking Expense | ||||||||||||
20 | Cost of the asset/equipment/software development | Project | $ 1,000 | $ 2,000 | $ 3,000 | $ 4,000 | $ 5,000 | $ 6,000 | $ 7,000 | $ 8,000 | CapEx | |||
21 | Set-up expenditures - shipping, installation, etc. | IT | $ 20,000 | $ - | $ - | CapEx | ||||||||
22 | Continued investment in asset over years, if any | LGRC | $ 1 | $ 1 | $ - | $ - | $ - | CapEx | ||||||
23 | Sales tax on purchases | $ - | $ - | $ - | $ - | CapEx | ||||||||
24 | Workforce Env access to member Env HW - PAW [EXAMPLE] | $ - | $ - | $ - | $ - | CapEx | ||||||||
25 | Citrix Deployment by LK Method [EXAMPLE] | $ - | $ - | $ - | $ - | CapEx | ||||||||
26 | [Project specific capitalized expense] | $ - | $ - | $ - | $ - | CapEx | ||||||||
27 | [Project specific capitalized expense] | $ - | $ - | $ - | $ - | CapEx | ||||||||
28 | ||||||||||||||
29 | Total - Investment Cash Flows (Capatalized) | $ 21,001 | $ 2,001 | $ 3,000 | $ 4,000 | $ 5,000 | $ 6,000 | $ 7,000 | $ 8,000 | |||||
30 | ||||||||||||||
32 | Operating Cash Flows (Expensed during Project Implementation) | Cash Flow Characteristics | 2023 - Q1 | 2023 - Q2 | 2023 - Q3 | 2023 - Q4 | 2024 | 2025 | 2026 | 2027 | OpEx Categorization | |||
33 | Cash Flow Types | Division/Project Booking Expense | ||||||||||||
34 | Expenses funded by department OpEx budgets | Project | $ 2,000 | $ - | $ - | $ - | $ - | $ - | $ - | $ - | OpEx | |||
35 | Legal expenses | Operations | $ - | $ 4,000 | $ - | $ - | $ - | $ - | $ - | $ - | OpEx | |||
36 | Fraud prevention expenses | Marketing/Co-Op Affairs | $ - | $ - | $ 6,000 | $ - | $ - | $ - | $ - | $ - | OpEx | |||
37 | Hiring/recruiting expenses | $ - | $ - | $ - | $ 8,000 | $ - | $ - | $ - | $ - | OpEx | ||||
38 | Data management costs | $ - | $ - | $ - | $ - | $ 10,000 | $ - | $ - | $ - | OpEx | ||||
39 | Incremental transaction-related expenses | $ - | $ - | $ - | $ - | $ - | $ 12,000 | $ - | $ - | OpEx | ||||
40 | M365 license upgrade (true up) [EXAMPLE] | $ - | $ - | $ - | $ - | $ - | $ - | $ 14,000 | $ - | OpEx | ||||
41 | Fiserv vendor support [EXAMPLE] | $ - | $ - | $ - | $ - | $ - | $ - | $ - | $ 16,000 | OpEx | ||||
42 | [Project specific operating expense] | $ - | $ - | $ - | $ - | $ - | $ - | $ - | $ - | OpEx | ||||
43 | [Project specific operating expense] | $ - | $ - | $ - | $ - | $ - | $ - | $ - | $ - | OpEx | ||||
44 | ||||||||||||||
45 | Total - Operating Cash Flows | $ 2,000 | $ 4,000 | $ 6,000 | $ 8,000 | $ 10,000 | $ 12,000 | $ 14,000 | $ 16,000 | |||||
46 | ||||||||||||||
48 | Operating Cash Flows (Expensed after Project Completion) | Cash Flow Characteristics | 2023 - Q1 | 2023 - Q2 | 2023 - Q3 | 2023 - Q4 | 2024 | 2025 | 2026 | 2027 | OpEx Categorization | |||
49 | Direct | Division/Project Booking Expense | ||||||||||||
50 | License fees | $ 1,500 | OpEx | |||||||||||
51 | On-going Vendor Contact | $ 2,000 | OpEx | |||||||||||
52 | Rent | $ 3,000 | OpEx | |||||||||||
53 | Maintenance | $ 4,000 | OpEx | |||||||||||
54 | Computing Costs | $ 5,000 | OpEx | |||||||||||
55 | Software/hardware maintenance | $ 6,000 | OpEx | |||||||||||
56 | Credit/debit card production costs | $ 70,000 | OpEx | |||||||||||
57 | Workforce environment HW - PAW [EXAMPLE] | $ 8,000 | OpEx | |||||||||||
58 | Citrix Virtualization Licensing [EXAMPLE] | OpEx | ||||||||||||
59 | Licensing cost of PIDE environment [EXAMPLE] | OpEx | ||||||||||||
60 | [Project specific operating expenses] | OpEx | ||||||||||||
61 | [Project specific operating expenses] | OpEx | ||||||||||||
62 | ||||||||||||||
63 | Total - Direct Operating Cash Flows after Project Completion | $ 1,500 | $ 2,000 | $ 3,000 | $ 4,000 | $ 5,000 | $ 6,000 | $ 70,000 | $ 8,000 | |||||
B.CashOutflows |
Cell Formulas | ||
---|---|---|
Range | Formula | |
F2 | F2 | =IF(AND(B2="N/A",SUM($C$20:$J$29)>0),"← REVIEW: There are inputs in CapEx Outflow Stream","") |
F3 | F3 | =IF(AND(B3="N/A",SUM($C$34:$J$45)>0),"← REVIEW: There are inputs in OpEx Outflow Stream","") |
F4 | F4 | =IF(AND(B4="N/A",OR(SUM($C$50:$J$63)>0,SUM($C$68:$J$74)>0)),"← REVIEW: There are inputs in OpEx Outflow Stream","") |
F6 | F6 | =IF(AND(B6="N/A",SUM($C$50:$J$63)>0),"← REVIEW: There are inputs in Direct - Post Project OpEx Outflow Stream","") |
F7 | F7 | =IF(AND(B7="N/A",SUM($C$68:$J$74)>0),"← REVIEW: There are inputs in Direct - Post Project OpEx Outflow Stream","") |
F8 | F8 | =IF(AND(B8="N/A",SUM($C$79:$J$84)>0),"← REVIEW: There are inputs in Contingent/Consultant Outflow Stream","") |
F9 | F9 | =IF(AND(B9="N/A",OR(SUM($C$91:$J$100)>0,SUM($C$105:$J$109)>0,SUM($C$115:$J$119)>0)),"← REVIEW: There are inputs in Internal Labor Costs Outflow Stream","") |
F11 | F11 | =IF(AND(B11="N/A",SUM($C$91:$J$100)>0),"← REVIEW: There are inputs in Based on Hours Entry Outflow Stream","") |
F12 | F12 | =IF(AND(B12="N/A",SUM($C$105:$J$109)>0),"← REVIEW: There are inputs in Based on Estimated Salary Outflow Stream","") |
F13 | F13 | =IF(AND(B13="N/A",SUM($C$115:$J$119)>0),"← REVIEW: There are inputs in Open Entry Outflow Stream","") |
C18,C48,C32 | C18 | =YEAR(A.ProjectSummary!$C$4)&" - Q1" |
D18,D48,D32 | D18 | =YEAR(A.ProjectSummary!$C$4)&" - Q2" |
E18,E48,E32 | E18 | =YEAR(A.ProjectSummary!$C$4)&" - Q3" |
F18,F48,F32 | F18 | =YEAR(A.ProjectSummary!$C$4)&" - Q4" |
G18,G48,G32 | G18 | =YEAR(A.ProjectSummary!$C$4)+1 |
H18:J18,H48:J48,H32:J32 | H18 | =G18+1 |
C29:J29 | C29 | =SUM(C20:C27) |
C45:J45 | C45 | =SUM(C34:C43) |
C63:J63 | C63 | =SUM(C50:C61) |
Cells with Conditional Formatting | ||||
---|---|---|---|---|
Cell | Condition | Cell Format | Stop If True | |
B3 | Expression | =AND($B$3="N/A",SUM($C$34:$J$45)>0) | text | NO |
B9 | Expression | =AND(B9="N/A",OR(SUM($C$91:$J$100)>0,SUM($C$105:$J$109)>0,SUM($C$115:$J$119)>0)) | text | NO |
B13 | Expression | =AND($B$13="N/A",SUM($C$115:$J$119)>0) | text | NO |
B12 | Expression | =AND($B$12="N/A",SUM($C$105:$J$109)>0) | text | NO |
B4 | Expression | =AND($B$4="N/A",OR(SUM($C$50:$J$63)>0),SUM($C$68:$J$74)>0) | text | NO |
B6 | Expression | =AND($B$6="N/A",SUM($C$50:$J$63)>0) | text | NO |
B11 | Expression | =AND($B$11="N/A",SUM($C$91:$J$100)>0) | text | NO |
B7 | Expression | =AND($B$7="N/A",SUM($C$68:$J$74)>0) | text | NO |
B2 | Expression | =AND($B$2="N/A",SUM($C$20:$J$29)>0) | text | NO |
B8 | Expression | =AND($B$8="N/A",SUM($C$79:$J$84)>0) | text | NO |
Cells with Data Validation | ||
---|---|---|
Cell | Allow | Criteria |
B11 | List | Based on Hours Entry, N/A |
B12 | List | Estimated Salary, N/A |
B13 | List | Open Entry, N/A |
B2 | List | CapEx, N/A |
B3 | List | OpEx, N/A |
B4:B5 | List | Post Project OpEx, N/A |
B6 | List | Direct - Post Project OpEx, N/A |
B7 | List | Indirect - Post Project OpEx, N/A |
B8 | List | Contingent / Consultant Costs, N/A |
B9 | List | Internal Labor Costs, N/A |
L50:L61 | List | OpEx |
L34:L43 | List | OpEx |
L20:L27 | List | CapEx |
B20:B27 | List | =DropDownControl!$A$2:$A$10 |
B34:B43 | List | =DropDownControl!$A$2:$A$10 |
B50:B61 | List | =DropDownControl!$A$2:$A$10 |
VBA Code:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim TriggerRanges(1 To 10) As Range
Dim i As Integer
Set TriggerRanges(1) = Range("B2")
Set TriggerRanges(2) = Range("B3")
Set TriggerRanges(3) = Range("B4")
Set TriggerRanges(4) = Range("B8")
Set TriggerRanges(5) = Range("B9")
Set TriggerRanges(6) = Range("B6")
Set TriggerRanges(7) = Range("B7")
Set TriggerRanges(8) = Range("B11")
Set TriggerRanges(9) = Range("B12")
Set TriggerRanges(10) = Range("B13")
For i = 1 To 10
If Not Application.Intersect(TriggerRanges(i), Target) Is Nothing Then
If TriggerRanges(i).Value = "N/A" Then
Range(GetInputRange(i)).EntireRow.Hidden = True
Else
Range(GetInputRange(i)).EntireRow.Hidden = False
End If
End If
Next i
End Sub
Function GetInputRange(ByVal index As Integer) As String
Select Case index
Case 1
GetInputRange = "Investment_Cash_Flows"
Case 2
GetInputRange = "Operating_Cash_Flows"
Case 3
GetInputRange = "Post_Project_OpEx_Dropdown"
Case 4
GetInputRange = "Contingent_Consultant_Costs_Hours_Entry"
Case 5
GetInputRange = "Internal_Labor_Costs_Dropdown"
Case 6
GetInputRange = "Direct_Operating_Cash_Flows_After_Project_Completion"
Case 7
GetInputRange = "Indirect_Operating_Cash_Flows_After_Project_Completion"
Case 8
GetInputRange = "Internal_Labor_Costs_Hours_Entry"
Case 9
GetInputRange = "Internal_Labor_Costs_Estimated_Salaries"
Case 10
GetInputRange = "Internal_Labor_Costs_Open_Entry"
End Select
End Function