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

Macro trova valore e copia riga

Ultimo Aggiornamento: 22/12/2018 09:19
Post: 110
Registrato il: 03/10/2015
Città: ALBAREDO PER SAN MARCO
Età: 44
Utente Junior
2003
OFFLINE
21/12/2018 21:11

Buona sera e buone feste a tutti.Nel foglio1 ho l'archivio delle estrazioni del lotto. Mi servirebbe una macro che mi copia nel foglio2 tutta la riga in base al numero da me in indicato,come esempio ho usato il numero 72 e la macro dovrebbe copiarmi nel foglio2 82 righe. Grazie Matteo

Post: 24
Registrato il: 13/08/2015
Città: COMO
Età: 60
Utente Junior
excel 2016
OFFLINE
22/12/2018 00:29

Ciao,

Sub copia_lotto()
    Dim sh1 As Worksheet
    Dim sh2 As Worksheet
    Dim nRScelto As String
    Dim uR As Long
    Dim j As Long
    Dim i As Byte
    Dim x As Long
    Set sh1 = Foglio1
    Set sh2 = Foglio2
    Application.ScreenUpdating = False
    nRScelto = InputBox("Scegli un numero!")
    sh2.Cells.Clear
    With sh1
        uR = .Cells(Rows.Count, 1).End(xlUp).Row
        x = 1
        For j = 1 To uR
            For i = 4 To 8
                If .Cells(j, i) = Val(nRScelto) Then
                    .Range("A" & j & ":H" & j).Copy sh2.Cells(x, 1)
                    x = x + 1
                End If
            Next i
        Next j
    End With
    sh2.Activate
    sh2.Cells(1, 1).Select
    Application.ScreenUpdating = True
    Set sh1 = Nothing
    Set sh2 = Nothing
End Sub

Post: 110
Registrato il: 03/10/2015
Città: ALBAREDO PER SAN MARCO
Età: 44
Utente Junior
2003
OFFLINE
22/12/2018 09:19

Ottima macro Ges64 perfetta! Grazie Matteo
Vota: 15MediaObject5,0023 2
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 09:39. Versione: Stampabile | Mobile | Regolamento | Privacy
FreeForumZone [v.6.1] - Copyright © 2000-2024 FFZ srl - www.freeforumzone.com