Double click erase some cell content

samii

New Member
Joined
Feb 22, 2023
Messages
2
Office Version
  1. 2016
Platform
  1. Windows
Hi All ;
I am new in this useful community and i need your hepl plz .
i have a double click issue which erase a content of some cell only of some worksheet only after i locked the tab by password , the others tabs working as per normal , a content is hidden and locked .
i want some explanation and help . see below VBA , thank you in advance.

PS : in photo number 3 , all cells eve n sheet is locked and hidden , you can double click on each cell and content get erased / in photo number 2 , only some cell in green even sheet locked na hidden can get content erased after double click

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
ActiveSheet.Activate
If Not Application.Intersect(Range("E5"), Range(Target.Address)) Is Nothing Then
    Select Case Target.Value
    Case Is = "Reciprocating - gasoline": Range("34:37,41:46,48:50,53:55,57:57").EntireRow.Hidden = True
                        Range("38:40,47:47,51:52,56:56,58:58").EntireRow.Hidden = False
    Case Is = "Turbine - natural gas": Range("34:35,37:37,41:42,46:46,48:50,53:55,57:57").EntireRow.Hidden = True
                       Range("36:36,38:40,45:45,47:47,51:52,56:56,58:58").EntireRow.Hidden = False
    Case Is = "Recip - nat gas 4-stroke rich burn": Range("41:41,48:48,53:53,55:55").EntireRow.Hidden = True
                    Range("34:40,42:47,49:52,54:54,56:58").EntireRow.Hidden = False
    Case Is = "Recip - nat gas 2-stroke lean burn": Range("34:54,56:58").EntireRow.Hidden = False
                    Range("55:55").EntireRow.Hidden = True
    Case Is = "Recip - nat gas 4-stroke lean burn": Range("34:58").EntireRow.Hidden = False
                    Range("399:399").EntireRow.Hidden = True
    Case Is = "Reciprocating - propane": Range("34:58").EntireRow.Hidden = False
                    Range("399:399").EntireRow.Hidden = True
    Case Is = "Choose one": Range("34:58").EntireRow.Hidden = True
                    Range("399:399").EntireRow.Hidden = False
    End Select
End If

If Range("E5:E5") = "Reciprocating - diesel" And Range("E7:E7") >= 600 Then
    Range("34:37,41:46,48:50,53:55,57:57").EntireRow.Hidden = True
    Range("38:40,47:47,51:52,56:56,58:58").EntireRow.Hidden = False
End If

If Range("E5:E5") = "Reciprocating - diesel" And Range("E7:E7") < 600 Then
    Range("34:35,37:37,41:46,48:50,53:55,57:57").EntireRow.Hidden = True
    Range("36:36,38:40,47:47,51:52,56:56,58:58").EntireRow.Hidden = False
End If


    Dim rCell As Range
    Set rCell = Range("J19")

    Columns("K").EntireColumn.Hidden = True
    If rCell.Value = 6 Then Columns("K").EntireColumn.Hidden = False


End Sub
 

Attachments

  • 2.jpg
    2.jpg
    219.3 KB · Views: 12
Last edited by a moderator:

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
i have a double click issue
Nothing in the VBA code you posted (which is for the worksheet change event) pertains to the double-click event. Are you sure you posted the right code?
 
Upvote 0
first of all ;
appreciated deeply your prompt feedback , kinldy see attached a VBA code ..
 
Upvote 0
I see no attached code.

That said, you should post code, not attach it.
 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,252
Members
449,075
Latest member
staticfluids

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