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

unire e sommare due righe

Ultimo Aggiornamento: 10/04/2017 20:52
Post: 3.807
Registrato il: 13/03/2012
Città: LIVORNO
Età: 78
Utente Master
2010
OFFLINE
03/04/2017 17:20

elimina la macro worksheet_change e prova questa e solo questa
Sub CopiaIncolla()
LR = Cells(Rows.Count, "A").End(xlUp).Row
numvuote = WorksheetFunction.CountBlank(Range("B8:B" & LR))
numpiene = LR - numvuote
Range("A8:G" & numpiene).Copy
Range("A8:G" & numpiene).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
Application.CutCopyMode = False
Range("A" & numpiene + 1 & ":G" & LR).ClearContents
LR = Cells(Rows.Count, "A").End(xlUp).Row
Set Rng = Range("A7:G" & LR)
With ActiveWorkbook.Worksheets(1).Sort
      .SortFields.Clear
      .SortFields.Add Key:=Range( _
        "B8"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
      .SetRange Rng
      .Header = xlYes
      .MatchCase = False
      .Orientation = xlTopToBottom
      .SortMethod = xlPinYin
      .Apply
End With
J = 8
Direction = Cells(J, 1).Value
Do While Direction <> ""
   Do While Cells(J + 1, "B").Value = Cells(J, "B").Value
      Cells(J, "E").Value = Cells(J + 1, "E").Value + Cells(J, "E").Value
      Cells(J, "G").Value = Cells(J + 1, "G").Value + Cells(J, "G").Value
      Rows(J + 1).Delete
    Loop
    J = J + 1
    Direction = Cells(J, 1).Value
Loop
End Sub


----------
Win 10 - Excel 2010
allega un file di esempio, guadagnerai tempo tu e lo farai risparmiare a chi ti aiuta
Vota: 15MediaObject5,00143 1
Amministra Discussione: | Chiudi | Sposta | Cancella | Modifica | Notifica email Pagina precedente | 1 2 | 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 10:58. Versione: Stampabile | Mobile | Regolamento | Privacy
FreeForumZone [v.6.1] - Copyright © 2000-2024 FFZ srl - www.freeforumzone.com