Excel e gli applicativi Microsoft Office VBA cerca.vert e rendi la riga verde

Login Registrati
Stai vedendo 3 articoli - dal 1 a 3 (di 3 totali)
  • Autore
    Articoli
  • #4409 Score: 0 | Risposta

    marco_budin
    Partecipante
      2 pts
      ciao a tutti,
      Ho un file di controllo prodotti. Nel foglio "valutazione" scansiono i vari prodotti che controllo. Quello che mi piacerebbe è che quando ho scansionato quel prodotto (riconoscimento attraverso Serial Number), andasse nel foglio "magazzino" cercasse quel prodotto nella tabella (nome della tabella CAM), e quando lo ha trovato, rende di colore verde la riga.
      Attualmente ho creato la macro "registra",
      Sub registra()
      Sheets("lista").Select
      Rows("6:6").Insert
      Rows("1:1").Copy
      Rows("6:6").PasteSpecial Paste:=xlPasteAllUsingSourceTheme, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
      Rows("6:6").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
              :=False, Transpose:=False
              
      Sheets("lista1").Select
      Rows("6:6").Insert
      Rows("1:1").Copy
      Rows("6:6").PasteSpecial Paste:=xlPasteAllUsingSourceTheme, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
      Rows("6:6").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
              :=False, Transpose:=False
      
      Range("B6:C6").Select
          Application.CutCopyMode = False
          With Selection
              .HorizontalAlignment = xlCenter
              .VerticalAlignment = xlCenter
              .WrapText = True
              .Orientation = 0
              .AddIndent = False
              .IndentLevel = 0
              .ShrinkToFit = False
              .ReadingOrder = xlContext
              .MergeCells = False
          End With
          Selection.Merge
          Range("D6:E6").Select
          With Selection
              .HorizontalAlignment = xlCenter
              .VerticalAlignment = xlCenter
              .WrapText = True
              .Orientation = 0
              .AddIndent = False
              .IndentLevel = 0
              .ShrinkToFit = False
              .ReadingOrder = xlContext
              .MergeCells = False
          End With
          Selection.Merge
          Range("G6:J6").Select
          With Selection
              .HorizontalAlignment = xlCenter
              .VerticalAlignment = xlCenter
              .WrapText = True
              .Orientation = 0
              .AddIndent = False
              .IndentLevel = 0
              .ShrinkToFit = False
              .ReadingOrder = xlContext
              .MergeCells = False
          End With
          Selection.Merge
          Range("K6:M6").Select
          With Selection
              .HorizontalAlignment = xlCenter
              .VerticalAlignment = xlCenter
              .WrapText = True
              .Orientation = 0
              .AddIndent = False
              .IndentLevel = 0
              .ShrinkToFit = False
              .ReadingOrder = xlContext
              .MergeCells = False
          End With
          Selection.Merge
            
      Sheets("lista1").Range("6:6").Copy
      Sheets("Scheda").Range("22:22").Insert Shift:=xlDown
      
      Sheets("lista").Range("6:6").Copy
      Sheets("Materiale").Range("14:14").Insert Shift:=xlDown
      
              
      Sheets("Valutazione").Select
      Range("E33:J36").ClearContents
      Range("E27:H27").ClearContents
      Range("E21:h21").ClearContents
      Range("E12:g12").ClearContents
      Range("E12:g12").Select
            
      End Sub
       
      Prima dell'ultima parte, dove torna al foglio "Valutazione" e poi cancella le celle, vorrei che andasse nel "magazzino"cercasse il serial number della cella E2 del foglio "valutazione" e trovasse quel codice nella tabella foglio magazzino, e rendesse quella riga verde.
      così so che è stato scansionato e ho un controllo!
       
      qualcuno riesce ad aiutarmi?
      vi ringrazio anticipatamente per l'aiuto che mi date, come sempre!
       
      saluti e a presto
      Marco
      Allegati:
      You must be logged in to view attached files.
      #4414 Score: 0 | Risposta

      patel
      Moderatore
        51 pts
        puoi colorare la cella contenente il serial number con
        Sub verde()
        sn = Sheets("Valutazione").Range("E12")
          With Sheets("Magazzino").Columns("A:A")
            Set c = .Find(sn, LookIn:=xlValues)
            If Not c Is Nothing Then c.Interior.Color = 5296274
          End With
        End Sub
        #4422 Score: 0 | Risposta

        marco_budin
        Partecipante
          2 pts
          Ciao patel!
          Grazie mille come sempre per le tue preziose risposte.
          Funziona tutto alla grande
          Ti augurp un buon weekeend
          Saluti e alla prossima
          Marco
        Login Registrati
        Stai vedendo 3 articoli - dal 1 a 3 (di 3 totali)
        Rispondi a: VBA cerca.vert e rendi la riga verde
        Gli allegati sono permessi solo ad utenti REGISTRATI
        Le tue informazioni: