
Sub copia_e_moltiplica()
Dim elenco As Range, nome As Range
Dim n As Variant
Dim i As Integer
Application.ScreenUpdating = False
Sheets("Sheet1").[a1].CurrentRegion.Copy _
Destination:=Sheets("Sheet2").[a1]
Sheets("Sheet2").Activate
Set elenco = Range("b1:b5")
For Each nome In elenco
n = Split(nome, ";")
If UBound(n) = 1 Then
nome.Value = n(1)
ElseIf UBound(n) > 1 Then
nome.Value = n(0)
For i = 1 To UBound(n)
nome.Offset(i, 0).EntireRow.Insert
nome.Offset(i, 0).Value = n(i)
nome.Offset(i, -1).Value = nome.Offset(0, -1)
Next i
End If
Next
Application.ScreenUpdating = True
End Sub
|
Sub copia_e_moltiplica()
Dim elenco As Range, Processo As Range
Dim n As Variant
Dim i As Integer
Sheets("Sheet2").Select
Cells.Select
Selection.ClearContents
Range("A1").Select
Application.ScreenUpdating = False
Sheets("Sheet1").[a1].CurrentRegion.Copy _
Destination:=Sheets("Sheet2").[a1]
Sheets("Sheet2").Activate
Set elenco = Range("I1:I10000")
For Each Processo In elenco
n = Split(Processo, ";")
If UBound(n) = 1 Then
Processo.Value = n(1)
ElseIf UBound(n) > 1 Then
Processo.Value = n(0)
For i = 1 To UBound(n)
Processo.Offset(i, 0).EntireRow.Copy
Processo.Offset(i, 0).EntireRow.Insert
Processo.Offset(i, 0).Value = n(i)
Processo.Offset(i, -1).Value = Processo.Offset(0, -1)
Next i
End If
Next
Application.ScreenUpdating = True
End Sub
|
Sub copia_e_moltiplica()
Dim elenco As Range, nome As Range
Dim n As Variant
Dim i As Integer, tot As Integer
Application.ScreenUpdating = False
Sheets("Sheet2").Cells.ClearContents
Sheets("Sheet1").[a1].CurrentRegion.Copy _
Destination:=Sheets("Sheet2").[a1]
Sheets("Sheet2").Activate
tot = [counta(i:i)]
Set elenco = Range("i1:i" & tot)
For Each nome In elenco
n = Split(nome, ";")
If UBound(n) = 1 Then
nome.Value = n(1)
ElseIf UBound(n) > 1 Then
nome.Value = n(0)
For i = 1 To UBound(n)
nome.EntireRow.Copy
nome.Offset(i, 0).EntireRow.Insert
nome.Offset(i, 0).Value = n(i)
nome.Offset(i, -1).Value = nome.Offset(0, -1)
Next i
End If
Next
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub
|
Sub copia_e_moltiplica()
Dim elenco As Range, nome As Range, primonome As Range
Dim n As Variant
Dim i As Integer, tot As Integer
Application.ScreenUpdating = False
Sheets("Sheet2").Cells.ClearContents
Sheets("Sheet1").[a1].CurrentRegion.Copy _
Destination:=Sheets("Sheet2").[a1]
Sheets("Sheet2").Activate
tot = [counta(a:a)]
Set elenco = Range("I1:I" & tot)
For Each nome In elenco
n = Split(nome, ";")
If Left(nome, 1) = ";" Then
nome.Value = n(1)
ElseIf UBound(n) >= 1 Then
nome.Value = n(0)
For i = 1 To UBound(n)
nome.EntireRow.Copy
nome.Offset(i, 0).EntireRow.Insert
nome.Offset(i, 0).Value = n(i)
nome.Offset(i, -1).Value = nome.Offset(0, -1)
Next i
End If
Next
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub |
Sub copia_e_moltiplica()
Dim elenco As Range, nome As Range
Dim n As Variant
Dim i As Integer, tot As Integer
Application.ScreenUpdating = False
Sheets("Sheet2").Cells.ClearContents
Sheets("Sheet1").[a1].CurrentRegion.Copy _
Destination:=Sheets("Sheet2").[a1]
Sheets("Sheet2").Activate
tot = [counta(a:a)]
Set elenco = Range("i1:i" & tot)
For Each nome In elenco
If nome <> "" Then
n = Split(nome, ";")
If n(0) = "" Then
nome.Value = n(1)
ElseIf n(0) <> "" Then
nome.Value = n(0)
For i = 1 To UBound(n)
nome.EntireRow.Copy
nome.Offset(i, 0).EntireRow.Insert
nome.Offset(i, 0).Value = n(i)
nome.Offset(i, -1).Value = nome.Offset(0, -1)
Next i
End If
End If
Next
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub
|
