Jul 11 2021 05:31 PM
Jul 12 2021 02:44 AM
Jul 12 2021 03:59 AM
Jul 12 2021 04:30 AMSolution
Right-click the sheet tab.
Select 'View Code' from the context menu.
I created a Worksheet_BeforeDoubleClick event procedure. This is run automatically each time you double-click a cell.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) If Not Intersect(Range("B2:B20"), Target) Is Nothing Then Cancel = True Select Case Target.Value Case "X" Target.Value = "P" Case "O" Target.Value = "X" Case Else Target.Value = "O" End Select End If End Sub
The code first checks whether the cell is in the range B2:B20.
If so, it sets Cancel to True to prevent going into edit mode.
Then it changes the value of the cell depending on the current value.
Jul 12 2021 04:32 AM
Jul 12 2021 05:32 AM
If, with everyone's permission, I may add my humble opinion.
With settings: right click on the button and then under "Format control" - "Properties" - "Depending on cell position and size".
Private Sub posbuttons() Dim pos1 As Range Set pos1 = Range("d7") With Me CommandButton1 .Height = pos1.Height .Width = pos1.Width .Top = pos1.Top .Left = pos1.Left End With End Sub
The 10 and 5 as row and column variables in the code and the potato salad is ready! :))
I would be happy to know if I could help.
I know I don't know anything (Socrates)