Pagina precedente | 1 | Pagina successiva
Vota | Stampa | Notifica email    
Autore

Controllo incrociato su piu fogli

Ultimo Aggiornamento: 09/03/2018 15:53
Post: 15
Registrato il: 11/01/2013
Città: MILANO
Età: 46
Utente Junior
2013
OFFLINE
27/02/2018 16:26

vorrei creare un file con N fogli, dove però posso verificare se un codice è presente in piu fogli riportandomi il titolo del foglio come risultato.
esempio:
nel foglio 1 ho presente il codice vite m22, ma anche nei fogli 7 e 8 ho la stessa voce, come risultato avere un risultato (non so come se con una finestra o in altro modo possibile) che se scrivo m22 mi risponda
Foglio1
Foglio 7
Foglio 8.
Excel 2010
Post: 3.199
Registrato il: 28/06/2011
Città: AGORDO
Età: 70
Utente Master
2013
OFFLINE
27/02/2018 20:41

Mouse Destro sul foglio dove scrivi, visualizza/codice e incolla a destra
Questa vba, solo se scritto in colonna A controlla tutti i fogli in colonna A
vb
Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Range("A:A")) Is Nothing Then
        Dim Msg As String, Area As Range, R As Object, Strg As String, Ws As Worksheet, Fg As String
        Strg = Target.Offset(0, 0).Value
        Fg = ActiveSheet.Name
        For Each Ws In ActiveWorkbook.Worksheets
        If Ws.Name <> Fg Then
        Set Area = Ws.Range("A:A")
        Set R = Area.Find(Strg, LookIn:=xlValues, LookAt:=xlWhole)
            If Not R Is Nothing Then
                Msg = Msg & Ws.Name & vbCrLf
            End If
        End If
        Next Ws
        
    End If
MsgBox " Trovato in..." & vbCrLf & Msg
Set Area = Nothing
Set R = Nothing
End Sub
Excel 2013
Post: 16
Registrato il: 11/01/2013
Città: MILANO
Età: 46
Utente Junior
2013
OFFLINE
28/02/2018 08:25

Grazie mille, faccio qualche prova.
Excel 2010
Post: 19
Registrato il: 11/01/2013
Città: MILANO
Età: 46
Utente Junior
2013
OFFLINE
02/03/2018 08:23

ottimo, ti chiedo una miglioria se possibile, ho la possibilità di mettere come risultato invece che solo nome foglio anche due valori inseriti nella prima riga e cella e colonna.

ti invio allegato per capirci, ricerca della cella gialla 02.89
il risultato sarebbe Foglio1-Pluto-Modello.
Excel 2010
Post: 3.214
Registrato il: 28/06/2011
Città: AGORDO
Età: 70
Utente Master
2013
OFFLINE
02/03/2018 13:23

Fatto e se non trova nulla, non appare il MSG
vb
Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Range("A:A")) Is Nothing Then
        Dim Msg As String, Area As Range, R As Object, Strg As String, Ws As Worksheet, Fg As String, N  As Long, Rr  As Long
        Strg = Target.Offset(0, 0).Value
        Fg = ActiveSheet.Name
        For Each Ws In ActiveWorkbook.Worksheets
        If Ws.Name <> Fg Then
        Set Area = Ws.Range("A:A")
        Set R = Area.Find(Strg, LookIn:=xlValues, LookAt:=xlWhole)
            If Not R Is Nothing Then
                Rr = R.Row
                Msg = Msg & Ws.Name & " " & Ws.Cells(Rr, 1) & " " & Ws.Cells(Rr, 2) & vbCrLf
                N = N + 1
            End If
        End If
        Next Ws
    End If
If N > 0 Then MsgBox " Trovato in..." & vbCrLf & Msg
Set Area = Nothing
Set R = Nothing
End Sub
Excel 2013
Post: 20
Registrato il: 11/01/2013
Città: MILANO
Età: 46
Utente Junior
2013
OFFLINE
02/03/2018 15:46

Io ho fatto questo con un pulsante nella home:

Sub Macro3()
'
' Macro3 Macro
'

'
Dim CosaCerco As String
Dim Cerco As Range
Dim Trovato As String
Dim PrimoTrovato As Range
Dim Foglio As Worksheet
CosaCerco = InputBox("Inserisci CODICE da Cercare", "RICERCA", "testoDefault")

For Each Foglio In ActiveWorkbook.Sheets
Set Cerco = Foglio.Cells.Find(What:=CosaCerco, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False)
If Not Cerco Is Nothing Then
Set PrimoTrovato = Cerco
Do
Trovato = Trovato & vbCrLf & Cerco.Parent.Name & "-" & Cerco.Address
Set Cerco = Foglio.Cells.FindNext(Cerco)
Loop While (Not (Cerco Is Nothing) And (Cerco.Address <> PrimoTrovato.Address))
End If
Next
MsgBox Trovato
End Sub

come applico la tua modifica, mi da errore [SM=x423039]
Excel 2010
Post: 3.217
Registrato il: 28/06/2011
Città: AGORDO
Età: 70
Utente Master
2013
OFFLINE
02/03/2018 16:44

A me funziona bene, dovrei vedere il Tuo file.
Inserisci come seconda riga>>> MsgBox "premi CTRL+ALT+Pause"
Vai nel codice e premi continuamente F8 per vedere in quale riga fà l'errore?
Excel 2013
Post: 22
Registrato il: 11/01/2013
Città: MILANO
Età: 46
Utente Junior
2013
OFFLINE
02/03/2018 17:01

PRATICAMENTE HO FATTO:

destro sul pulsante, assegna macro, modifica e sostituito con la tua.
Excel 2010
Post: 3.218
Registrato il: 28/06/2011
Città: AGORDO
Età: 70
Utente Master
2013
OFFLINE
02/03/2018 18:31

>>>Mouse Destro sul foglio dove scrivi, visualizza/codice e incolla a destra
La mia non và collegata ad un bottone, interviene ogni volta che scrivi in colonna A
Excel 2013
Post: 24
Registrato il: 11/01/2013
Città: MILANO
Età: 46
Utente Junior
2013
OFFLINE
03/03/2018 10:14

riusciresti a modificare il mio pulsante in modo da poterlo mantenere ???
Excel 2010
Post: 26
Registrato il: 11/01/2013
Città: MILANO
Età: 46
Utente Junior
2013
OFFLINE
09/03/2018 09:05

Riesci ad aiutarmi ??
Excel 2010
Post: 3.251
Registrato il: 28/06/2011
Città: AGORDO
Età: 70
Utente Master
2013
OFFLINE
09/03/2018 15:53

>>>riusciresti a modificare il mio pulsante in modo da poterlo mantenere ???
Modificare un pulsante?
Excel 2013
Vota:
Amministra Discussione: | Chiudi | Sposta | Cancella | Modifica | Notifica email Pagina precedente | 1 | Pagina successiva
Nuova Discussione
 | 
Rispondi
Cerca nel forum
Tag discussione
Discussioni Simili   [vedi tutte]
Feed | Forum | Bacheca | Album | Utenti | Cerca | Login | Registrati | Amministra
Tutti gli orari sono GMT+01:00. Adesso sono le 14:33. Versione: Stampabile | Mobile | Regolamento | Privacy
FreeForumZone [v.6.1] - Copyright © 2000-2024 FFZ srl - www.freeforumzone.com