Jump to content
Sign in to follow this  
Milton Cordova

Registrar "s" y "n"

Recommended Posts

saludos deseo algun apoyo para complementar una macro que ingrese una "S" al hacer doble click en la celda A10, al hacer otra vez sobre esta celda boble click se elimine la X y se ingrese "N".

adjunto la macro

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

If Intersect(Target, Range("A10")) Is Nothing Then Exit Sub

Cancel = True

Select Case Target.Value

Case vbNullString, ""

Target.Value = "S"

Case "S"

Target.Value = "N"

Case "N"

End Select

End Sub

Share this post


Link to post
Share on other sites

Revise el adjunto, tiene la macro que le pongo a continuación.

Private Sub Worksheet_BeforeDoubleClick( _
ByVal Target As Range, Cancel As Boolean)
Dim rInt As Range
Dim rCell As Range

Set rInt = Intersect(Target, Range("A10"))

If Not rInt Is Nothing Then
For Each rCell In rInt

If rCell.Value = "S" Then
rCell.Value = "N"
Else
rCell.Value = "S"
End If

Next
End If
Set rInt = Nothing
Set rCell = Nothing
Cancel = True

End Sub
[/PHP]

Esta parte del codigo

Intersect(Target, Range("A10"))

La puede modificar para ampliar el rango, por ejemplo;

Intersect(Target, Range("A1:A10"))

Cambiar estado celda con Doble Click.zip

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  



×
×
  • Create New...

Important Information

Privacy Policy


CTA Templates.png