Re: Deselecting - VBA

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Public Sub ARM()
'
'Entry into this routine is by button depression. Each sheet has a button
controling the single cell
'
'
If Sheets("Param").Range("S30") = "Off" Then
Sheets("Param").Range("S30") = "On"
ActiveSheet.Shapes("Button 1").Select
With Selection.Characters(Start:=1, Length:=8).Font
.ColorIndex = 3 ' Red Font indicates that the "Cell
Selection Change" is arm'ed
End With
Else
Sheets("Param").Range("S30") = "Off"
ActiveSheet.Shapes("Button 1").Select
With Selection.Characters(Start:=1, Length:=8).Font
.ColorIndex = 21 ' Green indicates that "Cell Selection Change"
is off.
End With
End If
End Sub

"Jim Thomlinson" <James_Thomlinson@xxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:A159F28B-975C-4337-89E6-40730C384C87@xxxxxxxxxxxxxxxx
Post your code...
--
HTH...

Jim Thomlinson


"C Brandt" wrote:

In a vba routine I have selected a "button" to change the color of the
Font
as an indication of whether the button is in one mode or another. When
the
routine is complete the button remains selected and therefore whenever I
depress it, it thinks I am in edit mode and doesn't function as a
button.

How do I "deselect" the button within VBA prior to leaving the routine
without selecting something else in the sheet.

Thanks for any assistance,

Craig





.



Relevant Pages

  • Re: What is the difference beyween "Sheets" and WorkSheets" in sub
    ... It seems that Excel was incrementing the number of the new sheet ... I went ahead and changed all instances of Sheets to Worksheets just to ... >> routine works (at least on my machine; the one it was composed on. ... >> indicate it routine is calling the macro from an old version of the ...
    (microsoft.public.excel.programming)
  • RE: Find & Replace macro help needed
    ... TestAutomated routine could be easily adapted to do it with no pre-selecting ... 'presumes you select all of the cells in the 'source' sheet first ... the quotes for rngData. ... The rngData is defined and refers to a SEPARATE worksheet called Codes. ...
    (microsoft.public.excel.programming)
  • Re: Visual Basic Error Run Time Error, Type Mismatch
    ... I'm confused as to why you are unprotecting the active sheet, but then re-protecting all the sheets in the workbook at the end of the routine. ... Private Sub Worksheet_Change ... Dim wSheet As Worksheet ...
    (microsoft.public.excel.misc)
  • RE: function "compile error msg: procedure too large"
    ... previous employee new to programming. ... Visual Basic) and was over 6000 lines of code, all one main routine, no ... > Hi Rashesh, ... > move data into the sheet, one to reformat cells, etc. Try that. ...
    (microsoft.public.excel.programming)
  • RE: Excel Macro Looping Helps
    ... Now I can run the macro without moving data from the original workbook ... I had to save the routine to the module. ... sheet name without creating an error (i.e. you should be able to name a sheet ...
    (microsoft.public.excel.misc)