Moderatori: Anthony47, Flash30005
Flash30005 ha scritto:Si,
togliere le celle unite
Flash30005 ha scritto:Non trovo altra soluzione![]()
ciao
Sub OrdinaConUnione()
UR = Range("A" & Rows.Count).End(xlUp).Row
Range("G1:K" & UR).UnMerge
Range("A1:O" & UR).Select
Selection.Sort Key1:=Range("A2"), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("G1:K1").Select
Selection.Merge
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlTop
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Selection.Copy
Range("G2:K" & UR).Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Range("A1").Select
End Sub
Flash30005 ha scritto:Una macro possibile potrebbe essere questa
- Codice: Seleziona tutto
Sub OrdinaConUnione()
UR = Range("A" & Rows.Count).End(xlUp).Row
Range("G1:K" & UR).UnMerge
Range("A1:O" & UR).Select
Selection.Sort Key1:=Range("A2"), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("G1:K1").Select
Selection.Merge
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlTop
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Selection.Copy
Range("G2:K" & UR).Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Range("A1").Select
End Sub
Sub OrdinaConUnione()
UR = Range("A" & Rows.Count).End(xlUp).Row
Range("G1:K" & UR).UnMerge
Range("A1:O" & UR).Select
Selection.Sort Key1:=Range("A2"), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("G1:K1").Select
Selection.Merge
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xltop
.WrapText = True
.MergeCells = True
End With
Selection.Copy
Range("G2:K" & UR).Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Rows("1:" & UR).RowHeight = 30 '<<<<<<<< aumentare o diminuire questo valore
Range("A1").Select
End Sub
Sub OrdinaConUnione()
UR = Range("A" & Rows.Count).End(xlUp).Row
Range("G1:K" & UR).UnMerge
Range("A1:O" & UR).Select
Selection.Sort Key1:=Range("A2"), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("G1:K1").Select
Selection.Merge
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = True
.MergeCells = True
End With
Range("G2:K2").Select
Selection.Merge
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlTop
.WrapText = True
.MergeCells = True
End With
Range("G3:K3").Select
Selection.Merge
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlTop
.WrapText = True
.MergeCells = True
End With
Selection.Copy
Range("G4:K" & UR).Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Rows("2:" & UR).RowHeight = 40
Range("A1").Select
End Sub
Flash30005 ha scritto:Questa dovrebbe andare bene
- Codice: Seleziona tutto
Sub OrdinaConUnione()
UR = Range("A" & Rows.Count).End(xlUp).Row
Range("G1:K" & UR).UnMerge
Range("A1:O" & UR).Select
Selection.Sort Key1:=Range("A2"), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("G1:K1").Select
Selection.Merge
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = True
.MergeCells = True
End With
Range("G2:K2").Select
Selection.Merge
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlTop
.WrapText = True
.MergeCells = True
End With
Range("G3:K3").Select
Selection.Merge
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlTop
.WrapText = True
.MergeCells = True
End With
Selection.Copy
Range("G4:K" & UR).Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Rows("2:" & UR).RowHeight = 40
Range("A1").Select
End Sub
Sub OrdinaConUnione()
UR = Range("A" & Rows.Count).End(xlUp).Row
Range("G1:K" & UR).UnMerge
Range("A1:O" & UR).Select
Selection.Sort Key1:=Range("A2"), Order1:=xlAscending, Key2:=Range("B2") _
, Order2:=xlAscending, Header:=xlYes, OrderCustom:=1, MatchCase:=False _
, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, DataOption2:= _
xlSortNormal
Range("G1:K1").Select
Selection.Merge
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = True
.MergeCells = True
End With
Range("G2:K2").Select
Selection.Merge
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlTop
.WrapText = True
.MergeCells = True
End With
Range("G3:K3").Select
Selection.Merge
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlTop
.WrapText = True
.MergeCells = True
End With
Selection.Copy
Range("G4:K" & UR).Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Rows("2:" & UR).RowHeight = 40
Range("A1").Select
End Sub
Anthony47 ha scritto:Quindi non hai le colonne "da G a K unite", ma solo alcune celle e non nella testata ma nel corpo dei dati...
Anthony47 ha scritto:Forse dovresti fare differenza tra fogli da visualizzare (dove le colonne unite fanno il loro onesto lavoro) e fogli da elaborare (dove le colonne unite mostrano il loro subdolo comportamento).
Ciao
karug64 ha scritto:L'eleborazione che poi faccio ( o tento di fare)
Flash30005 ha scritto:karug64 ha scritto:L'eleborazione che poi faccio ( o tento di fare)
Ma non va bene nemmeno la macro nel post delle ore 11:21 ?
Sub NomiUnivoci_new()
For x = 0 To 29
benef(x) = ""
Next x
' trovo la prima riga del corpo (la cerco per evitare che se qualcuno
' inserisce o elimina righe nella testata ...)
PR = 0
For xben = 1 To 500
If Trim(Cells(xben, 10).Value) = "Beneficiario finale" Then
PR = xben + 1
Exit For
End If
Next xben
' trovata l'intestazione con PR > 0 ora leggo le righe del corpo
If PR > 0 Then
UR = Range("J" & Rows.Count).End(xlUp).Row
For y = PR To UR
' nella cella c'e' un valore
If Len(Trim(Cells(y, 10).Value)) <> 0 Then
testben = ""
testben = Trim(Cells(y, 10).Value)
' trovo l'ultimo elemento inserito nell'array
For yy = 0 To 29
If Len(Trim(benef(yy))) = 0 Then
ultimo = yy
Exit For
End If
Next yy
' cerco il nome nell'array
trov = 0
For y1 = 0 To 29
If benef(y1) = testben Then trov = 1
Next y1
If trov = 0 Then
If ultimo = 0 Then
benef(ultimo) = testben
Else
benef(ultimo) = testben
End If
End If
End If
Next y
' ora cancello le celle riepilogative e poi riscrivo l'array
For be = 9 To PR - 2
Cells(be, 10).Value = ""
Next be
For be = 0 To ultimo
If Len(Trim(benef(be))) <> 0 Then
Cells(be + 9, 10).Value = benef(be)
End If
Next be
End If
End Sub
Torna a Applicazioni Office Windows
Ordinare colonne sulla stessa riga se stesso contenuto Autore: Ricky0185 |
Forum: Applicazioni Office Windows Risposte: 6 |
Come evidenziare aree separate di un foglio Autore: Ricky0185 |
Forum: Applicazioni Office Windows Risposte: 18 |
Mettere tutto MAIUSCOLO un range di celle Autore: raimea |
Forum: Applicazioni Office Windows Risposte: 7 |
Supporto per sviluppo macro VBA Ordinare per data Autore: Carletto Ribolla |
Forum: Applicazioni Office Windows Risposte: 3 |
Visitano il forum: Nessuno e 16 ospiti