Si lo que quieres es saber cuando se modifica una celda, usa el evento Change de la hoja en cuestión, el siguiente codigo te muestra un mensaje, SOLO cuando la celda A3 ha sido modificada y en combinacion con el evento SelectionChange se puede dar la opcion de cancelar o regresar al valor anterior...<pre><font face="Courier New" size=2><font color = #000080>Option</font><font color = #000080>Explicit</font><font color = #000080>Dim</font> strValor<font color = #000080>As</font><font color = #000080>String</font><font color = #008000>'Este evento se produce cuando el usuario cambia una celda</font><font color = #000080>Private</font><font color = #000080>Sub</font> Worksheet_Change(<font color = #000080>ByVal</font> Target<font color = #000080>As</font> Range)<font color = #000080>Dim</font> Res<font color = #000080>As</font><font color = #000080>Integer</font><font color = #008000> 'Verificamos que celda se modifico</font><font color = #000080>If</font> Target.Address(<font color = #000080>False</font>,<font color = #000080>False</font>) = "A3"<font color = #000080>Then</font><font color = #008000> 'Informamos del cambio</font>
Res = MsgBox("La celda A3 ha sido modificada" & _
vbCrLf & vbCrLf & _
"Valor anterior = " & strValor & _
vbCrLf & _
"Valor actual = " & Target.Value & _
vbCrLf & vbCrLf & _
"¿Aceptas el cambio?", vbYesNo, "Confirmar")<font color = #000080>If</font> Res = vbNo<font color = #000080>Then</font><font color = #008000> 'Si responde que no, regresamos al valor anterior, es</font><font color = #008000> 'algo similar a cuando el usuario presiona Cancelar</font><font color = #008000> 'solo que aqui lo controlamos nosotros</font>
Application.EnableEvents =<font color = #000080>False</font>
Target.Value = strValor
Application.EnableEvents =<font color = #000080>True</font>
strValor = vbNullString<font color = #000080>Else</font>
strValor = Target.Value<font color = #000080>End</font><font color = #000080>If</font><font color = #000080>End</font><font color = #000080>If</font><font color = #000080>End</font><font color = #000080>Sub</font><font color = #008000>'Este evento se produce cuando el usuario cambia la seleccion</font><font color = #000080>Private</font><font color = #000080>Sub</font> Worksheet_SelectionChange(<font color = #000080>ByVal</font> Target<font color = #000080>As</font> Range)<font color = #008000> 'Verificamos que celda se selecciono</font><font color = #000080>If</font> Target.Address(<font color = #000080>False</font>,<font color = #000080>False</font>) = "A3"<font color = #000080>Then</font><font color = #008000> 'Si fue la celda A3 guardamos el valor actual</font>
strValor = Target.Value<font color = #000080>End</font><font color = #000080>If</font><font color = #000080>End</font><font color = #000080>Sub</font></font></pre>
_________________
TODO LO QUE NO ES DADO ES PERDIDO
This message was edited by valedor on 2002-08-02 21:44