Moderatori: Anthony47, Flash30005
=CERCA.VERT(A3;Foglio2!A1:C100;3)
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address(0, 0) = "A2" Then
Call ImmAle
End If
End Sub
Sub ImmAle()
'
FoglioTab = "Foglio1" '<< Inserire Nome corretto del foglio Dati
FoglioOut = "Foglio2" '<< Inserire Nome corretto del foglio di out
CellaPos = "F1" '<< Inserire indirizzo cella con CONFRONTA
'
'Cancella le immagini presenti sul foglio di output
Application.EnableEvents = False
Sheets(FoglioOut).Activate
For Each Pict In ActiveSheet.Shapes
Pict.Delete
Next Pict
'
'Cerca l’ immagine ….
RigaNum = Range("F1").Value
Sheets(FoglioTab).Activate
CurPos = Range("B" & RigaNum).Address
For Each Pict In ActiveSheet.Shapes
If Pict.TopLeftCell.Address = CurPos Then
NomeImm = Pict.Name: Exit For
End If
Next Pict
' …. e copiala su foglio di output
Sheets(FoglioOut).Activate
If NomeImm = "" Then
MsgBox ("Nessuna Immagine corrisponde")
GoTo Uscita
End If
Sheets(FoglioTab).Shapes(NomeImm).Copy
Range("B2").Select '<< Inserire Cella dove si vuole piazzare l’ immagine
ActiveSheet.Paste
Sheets("Foglio2").Select
Range("A2").Select
Uscita:
Application.EnableEvents = True
End Sub
=CONFRONTA(A2;Foglio1!A:A;0)
Sub ImmAle()
'
FoglioTab = "Foglio1" '<< Inserire Nome corretto del foglio Dati
FoglioOut = "Foglio2" '<< Inserire Nome corretto del foglio di out
CellaPos = "F1" '<< Inserire indirizzo cella con CONFRONTA
'
'Cancella le immagini presenti sul foglio di output
Application.EnableEvents = False
Sheets(FoglioOut).Activate
For Each Pict In ActiveSheet.Shapes
Pict.Delete
Next Pict
'
'Cerca l’ immagine ….
RigaNum = Range("F1").Value
Sheets(FoglioTab).Activate
CurPos = Range("B" & RigaNum).Address
For Each Pict In ActiveSheet.Shapes
If Pict.TopLeftCell.Address = CurPos Then
NomeImm = Pict.Name: Exit For
End If
Next Pict
' …. e copiala su foglio di output
Sheets(FoglioOut).Activate
If NomeImm = "" Then
MsgBox ("Nessuna Immagine corrisponde")
GoTo Uscita
End If
Sheets(FoglioTab).Shapes(NomeImm).Copy
Range("B2").Select '<< Inserire Cella dove si vuole piazzare l’ immagine
ActiveSheet.Paste
Uscita:
Application.EnableEvents = True
End Sub
=SE(VAL.NON.DISP(CONFRONTA(A2;Foglio1!A:A;0)); "Immagine NON presente"; CONFRONTA(A2;Foglio1!A:A;0))
Option Explicit ' <<=== Inserita
Sub ImmAle()
Dim FoglioTab, FoglioOut, CellaPos, Pict, RigaNum, CurPos, NomeImm ' <<=== Inserita
FoglioTab = "Foglio1" '<< Inserire Nome corretto del foglio Dati
FoglioOut = "Foglio2" '<< Inserire Nome corretto del foglio di out
CellaPos = "F1" '<< Inserire indirizzo cella con CONFRONTA
'
'Cancella le immagini presenti sul foglio di output
Application.EnableEvents = False
Sheets(FoglioOut).Activate
For Each Pict In ActiveSheet.Shapes
Pict.Delete
Next Pict
'
'Cerca l’ immagine ….
RigaNum = Range(CellaPos).Value ' <<==== Modificata
Sheets(FoglioTab).Activate
On Error GoTo Errore:
CurPos = Range("B" & RigaNum).Address ' <<=== Inserita
For Each Pict In ActiveSheet.Shapes
If Pict.TopLeftCell.Address = CurPos Then
NomeImm = Pict.Name: Exit For
End If
Next Pict
' …. e copiala su foglio di output
Sheets(FoglioOut).Activate
If NomeImm = "" Then
MsgBox ("Nessuna Immagine corrisponde")
GoTo Uscita
End If
Sheets(FoglioTab).Shapes(NomeImm).Copy
Range("B2").Select '<< Inserire Cella dove si vuole piazzare l’ immagine
ActiveSheet.Paste
Range("A2").Select
Uscita:
Application.EnableEvents = True
Exit Sub
Errore: ' <<=== Inserita
MsgBox "L'immagine non è presente", vbCritical ' <<=== Inserita
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address(0, 0) = "A2" Then
Call ImmAle
End If
End Sub
Errore:
MsgBox "L'immagine non è presente", vbCritical
End Sub
Errore:
MsgBox "L'immagine non è presente", vbCritical
GoTo Uscita ' <<=== Inserita
End Sub
Option Explicit
Sub ImmAle()
Dim FoglioTab, FoglioOut, CellaPos, Pict, RigaNum, CurPos, NomeImm
FoglioTab = "Foglio1" '<< Inserire Nome corretto del foglio Dati
FoglioOut = "Foglio2" '<< Inserire Nome corretto del foglio di out
CellaPos = "F1" '<< Inserire indirizzo cella con CONFRONTA
'
'Cancella le immagini presenti sul foglio di output
Application.EnableEvents = False
Sheets(FoglioOut).Activate
For Each Pict In ActiveSheet.Shapes
Pict.Delete
Next Pict
'
'Cerca l’ immagine ….
RigaNum = Range(CellaPos).Value
Sheets(FoglioTab).Activate
On Error GoTo Errore:
CurPos = Range("B" & RigaNum).Address
For Each Pict In ActiveSheet.Shapes
If Pict.TopLeftCell.Address = CurPos Then
NomeImm = Pict.Name: Exit For
End If
Next Pict
' …. e copiala su foglio di output
Sheets(FoglioOut).Activate
If NomeImm = "" Then
MsgBox ("Nessuna Immagine corrisponde")
GoTo Uscita
End If
Sheets(FoglioTab).Shapes(NomeImm).Copy
Range("B2").Select '<< Inserire Cella dove si vuole piazzare l’ immagine
ActiveSheet.Paste
Range("A2").Select
GoTo Uscita
Errore:
Sheets(FoglioOut).Activate
Range("A2").Select
MsgBox "L'immagine non è presente", vbCritical
Uscita:
Application.EnableEvents = True
End Sub
Torna a Applicazioni Office Windows
Inserire add.in nella barra di avvio veloce in excel 2003 Autore: Ricky0185 |
Forum: Applicazioni Office Windows Risposte: 4 |
Excel: problema con date se devo unirle a testi Autore: valle1975 |
Forum: Applicazioni Office Windows Risposte: 5 |
Immagine visibile e in posizione definita Autore: BG66 |
Forum: Applicazioni Office Windows Risposte: 21 |
Visitano il forum: Nessuno e 4 ospiti