Skip to content

Instantly share code, notes, and snippets.

@ncalm
Created January 27, 2025 16:55
Show Gist options
  • Save ncalm/55286087975c2fc8708f7eb7cbfa3c1c to your computer and use it in GitHub Desktop.
Save ncalm/55286087975c2fc8708f7eb7cbfa3c1c to your computer and use it in GitHub Desktop.
Option Explicit
Public Sub TogglePythonCells()
Dim cell As Range
For Each cell In Selection
If Left(cell.Formula2, 3) = "=PY" Then
If cell.HasFormula Then
cell.Formula2 = "'" & cell.Formula2
Else
cell.Formula2 = cell.Formula2
End If
End If
Next cell
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment