Cancellare campi e aggiungere



  • Cancellare campi e aggiungere
    di Matt (utente non iscritto) data: 05/12/2017 10:30:27

    Buongiorno,
    ho riscontrato una problematica in excel, praticamente ho un primo foglio di form in cui inserisco dei dati, tramite un apposito pulsante mi riporta i dati inseriti nel secondo foglio e fin qui nessun problema, cosa devo fare se volessi che all'azione di questo pulsante si cancellino anche i dati inseriti nel primo report? seconda domanda; come faccio a mantenere nel secondo foglio tutti i dati inseriti?
    grazie, allego il codice che ho scritto per la copia dei dati.
     
    Sub Inserisci()
    Dim Nrig As Long
    Dim Sh As String
    Sh = "Foglio2"
    Nrig = Sheets(Sh).Cells(Rows.Count, 4).End(xlUp).Row + 1
    Sheets(Sh).Cells(2, 1) = Cells(4, 7)
    Sheets(Sh).Cells(2, 2) = Cells(4, 15)
    Sheets(Sh).Cells(2, 3) = Cells(5, 2)
    Sheets(Sh).Cells(2, 4) = Cells(6, 2)
    Sheets(Sh).Cells(2, 5) = Cells(6, 12)
    Sheets(Sh).Cells(2, 6) = Cells(7, 2)
    Sheets(Sh).Cells(2, 7) = Cells(8, 2)
    Sheets(Sh).Cells(2, 8) = Cells(9, 2)
    Sheets(Sh).Cells(2, 9) = Cells(10, 2)
    Sheets(Sh).Cells(2, 10) = Cells(10, 13)
    Sheets(Sh).Cells(2, 11) = Cells(11, 5)
    Sheets(Sh).Cells(2, 12) = Cells(11, 11)
    Sheets(Sh).Cells(2, 13) = Cells(11, 16)
    Sheets(Sh).Cells(2, 14) = Cells(12, 2)
    Sheets(Sh).Cells(2, 15) = Cells(13, 2)
    Sheets(Sh).Cells(2, 16) = Cells(13, 13)
    Sheets(Sh).Cells(2, 17) = Cells(14, 2)
    Sheets(Sh).Cells(2, 18) = Cells(14, 13)
    Sheets(Sh).Cells(2, 19) = Cells(15, 2)
    Sheets(Sh).Cells(2, 20) = Cells(15, 9)
    Sheets(Sh).Cells(2, 21) = Cells(15, 16)
    Sheets(Sh).Cells(2, 22) = Cells(16, 2)
    Sheets(Sh).Cells(2, 23) = Cells(16, 9)
    Sheets(Sh).Cells(2, 24) = Cells(16, 16)
    Sheets(Sh).Cells(4, 1) = Cells(19, 1)
    Sheets(Sh).Cells(4, 2) = Cells(19, 2)
    Sheets(Sh).Cells(4, 3) = Cells(19, 3)
    Sheets(Sh).Cells(4, 4) = Cells(19, 4)
    Sheets(Sh).Cells(4, 5) = Cells(19, 5)
    Sheets(Sh).Cells(4, 6) = Cells(19, 6)
    Sheets(Sh).Cells(4, 7) = Cells(19, 7)
    Sheets(Sh).Cells(4, 8) = Cells(19, 8)
    Sheets(Sh).Cells(4, 9) = Cells(19, 9)
    Sheets(Sh).Cells(4, 10) = Cells(19, 10)
    Sheets(Sh).Cells(4, 11) = Cells(19, 11)
    Sheets(Sh).Cells(4, 12) = Cells(19, 12)
    Sheets(Sh).Cells(4, 13) = Cells(19, 13)
    Sheets(Sh).Cells(4, 14) = Cells(19, 14)
    Sheets(Sh).Cells(4, 15) = Cells(19, 15)
    Sheets(Sh).Cells(4, 16) = Cells(19, 16)
    Sheets(Sh).Cells(4, 17) = Cells(19, 17)
    Sheets(Sh).Cells(4, 18) = Cells(19, 18)
    Sheets(Sh).Cells(4, 19) = Cells(26, 18)
    Sheets(Sh).Cells(4, 20) = Cells(39, 1)
    Sheets(Sh).Cells(4, 21) = Cells(40, 3)
    End Sub
    



  • di Mister_x (utente non iscritto) data: 05/12/2017 11:37:53

    ciao

    spiegazione

    comunque potresti mettere ,dato che calcoli la riga ,aggiungere la riga
    se non e' questo che intendi posta un file con quello che vuoi fare

    ciao
     
    da cosi
    Sheets(Sh).Cells(2, 1) = Cells(4, 7)
    a cosi'
    Sheets(Sh).Cells(2+Nrig, 1) = Cells(4, 7)
    
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' seconda cosa  copiare tutto l'indirezzo alle celle sotto e aggiungere un clearcontents
    Sheets(Sh).Cells(4, 21) = Cells(40, 3)
      in questa posizione
    End Sub
    
    Sheets(Sh).Cells(4, 21) = Cells(40, 3)
    Cells(4, 7).ClearContents
    Cells(4, 15).ClearContents
    ecc. ecc
    End Sub