Hola,
Este código hace literalmente eso
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Me.Range("B2")) Is Nothing Then
Application.EnableEvents = False
Me.Range("B3").ClearContents
With Me.Range("B3").Validation
.Delete
Select Case Me.Range("B2").Value
Case 1
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _
Operator:=xlBetween, Formula1:="Avion,Barco"
Case 3
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _
Operator:=xlBetween, Formula1:="Barco"
Case Else
End Select
End With
Application.EnableEvents = True
End If
End Sub
Por
Israel Cassales, · publicado
Hola todos
agradezco de antemano cualquier gestión / ayuda
tengo dos pestañas
BBDD listado exportado de la ERP donde pueden cambiar los importes
USUARIO listado histórico de BDD
El código tiene que detectar por la columna del nº factura ( columna J ) y cuando detecte el mismo nº de factura que
actualice los importes de acuerdo a la exportación ( BBDD ).....que mal me explico. Lo siento.
Sub CORREGIRIMPORTES2()
Dim i, j As Integer
j = 3 ' DONDE EMPIEZA A ESCRIBIR
For i = 3 To 10000 ' DONDE EMPIEZA A BUSCAR
If Range("BBDD!J" & i) = Range("USUARIO!J" & j) Then
Range("BBDD!K" & i).Value = Range("USUARIO!K" & j).Value
j = j + 1
End If
Next
While Range("USUARIO!a" & j) <> ""
Range("USUARIO!a" & j) = ""
Range("USUARIO!b" & j) = ""
Range("USUARIO!c" & j) = ""
Range("USUARIO!d" & j) = ""
Range("USUARIO!e" & j) = ""
Range("USUARIO!f" & j) = ""
Range("USUARIO!g" & j) = ""
Range("USUARIO!h" & j) = ""
Range("USUARIO!i" & j) = ""
Range("USUARIO!j" & j) = ""
Range("USUARIO!k" & j) = ""
Range("USUARIO!L" & j) = ""
Range("USUARIO!M" & j) = ""
Range("USUARIO!N" & j) = ""
Range("USUARIO!O" & j) = ""
Range("USUARIO!P" & j) = ""
Range("USUARIO!Q" & j) = ""
j = j + 1
Wend
End Sub