Two Private Sub Worksheet Changes issue

BettaJ

New Member
Joined
Feb 25, 2020
Messages
11
Office Version
  1. 2007
Platform
  1. Windows
Hello all,

I can't seem to find this answer on the forum so I'm going to post this to see if anyone can help me.
If it's already in the forum somewhere, if you woudn't mind leading me to it.

So I have 1 VBA(?) that allows me to unlock certain cells when another is filled.
Then that one can then unlock another cell based on certain ranges of cells being fille.
Think of it as a check list for chores..1 cell is checked off, then another..and until all chores are complete, the person gets some money as the last unlocked cell is the guy that checks it for approval.

Anyway, I have another VBA(?) that when you double click the unlocked cell can be filled a green color. And left click once and it goes back to no fill.

I can't put them on the same sheet as below--it allows me to do one but then the color won't work:

Private Sub Worksheet_Change(ByVal Target As Range)
Me.Unprotect
If Target.Count > 1 Then Exit Sub
If Not Intersect(Target, Range("E4:E39")) Is Nothing Then
'Changed something in col E
Cells(Target.Row, "F").Locked = Not (Target <> "")
End If


If Not Intersect(Target, Range("F4:F39")) Is Nothing Then
Range(Cells(Target.Row, "J"), Cells(Target.Row, "J")).Locked = _
(WorksheetFunction.CountBlank(Range(Cells(Target.Row, "A"), Cells(Target.Row, "G"))) <> 0)
End If

Me.Protect
End Sub

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Cancel = True
Target.Interior.ColorIndex = 4
End Sub

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
Cancel = True
Target.Interior.ColorIndex = 0
End Sub


Would appreciate any help.
*Unfortunately, I cannot upload the file or get a screenshot as I don't think I can redact any info on in.

Thank you.
 
Last edited:

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
oh the error occurs at Target.Interior.ColorIndex = 4 this pops up when I double click the cell that I wanted to have the green color.
 
Upvote 0

Forum statistics

Threads
1,215,066
Messages
6,122,948
Members
449,095
Latest member
nmaske

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top