
Sub provincie()
Dim ur As Long, cella As Range, rng As Range, y As Long, v As Variant
With Sheets("Foglio1")
ur = .Cells(Rows.Count, 11).End(xlUp).Row
Set rng = Range(.Cells(4, 11), .Cells(ur, 11))
End With
y = 1
For Each cella In rng
For Each v In Array("appartamento", "villa")
cella.EntireRow.Copy Destination:=Sheets("Foglio2").Cells(y, 1)
y = y + 1
Next
Next
MsgBox "Fatto!"
End Sub
|
For Each cella In rng
Select Case cella
Case "MI"
cella.EntireRow.Copy Destination:=Sheets("Foglio2").Cells(y, 1)
y = y + 1
Case "SO"
cella.EntireRow.Copy Destination:=Sheets("Foglio2").Cells(y, 1)
y = y + 1
End Select
Next |
For Each cella In rng
Select Case cella
Case "MI", "SO"
cella.EntireRow.Copy Sheets("Foglio2").Cells(y, 1)
y = y + 1
End Select
Next |
For Each cella In rng
for each v in array ("MI","SO")
cella.EntireRow.Copy Sheets("Foglio2").Cells(y, 1)
y = y + 1
next
Next |
y = 1
For Each cella In rng
for each v in array ("MI","SO")
cella.EntireRow.Copy Sheets("Foglio2").Cells(y, 1)
y = y + 1
next
Next |
For Each cella In rng
Select Case cella
Case "MI", "SO"
cella.EntireRow.Copy Sheets("Foglio2").Cells(y, 1)
y = y + 1
End Select
Next |
Dim wrkPagina As Worksheet
Dim esiste As Boolean
For Each wrkPagina In Worksheets
If wrkPagina.Name = "MISO" Then
esiste = True
Exit For
End If
Next
If esiste = False Then
Set wrkPagina = ActiveWorkbook.Worksheets.Add()
wrkPagina.Name = "MISO"
End If
'istruzioni...
' For Each cella In Rng
' Select Case cella
' Case "MI", "SO"
' cella.EntireRow.Copy wrkPagina.Cells(y, 1)
' y = y + 1
' End Select
' Next
|
Sub fogli()
Dim wrkPagina As Worksheet
Dim esiste As Boolean
For Each wrkPagina In Worksheets
For Each v In Array("MISO", "TISO", "CISO")
If wrkPagina.Name = v Then
esiste = True
Exit For
ElseIf esiste = False Then
Set wrkPagina = ActiveWorkbook.Worksheets.Add()
wrkPagina.Name = v
End If
Next
Next |
Option Explicit
Sub fogli()
Dim wrkPagina As Worksheet
Dim esiste As Boolean, v As Variant
For Each v In Array("MISO", "TISO", "CISO")
For Each wrkPagina In Worksheets
If wrkPagina.Name = v Then
esiste = True
Exit For
ElseIf esiste = False Then
Set wrkPagina = ActiveWorkbook.Worksheets.Add()
wrkPagina.Name = v
Exit For ' <--- qui è il punto
End If
Next
Next
End Sub
|
Sub fogli()
Dim wrkPagina As Worksheet
Dim esiste As Boolean, v As Variant
For Each v In Array("MISO", "TISO", "CISO")
esiste = False
For Each wrkPagina In Worksheets
If wrkPagina.Name = v Then
esiste = True
Exit For
End If
Next
If esiste = False Then
Set wrkPagina = ActiveWorkbook.Worksheets.Add()
wrkPagina.Name = v
End If
Next
End Sub
|
Sub fogli()
Dim wrkPagina As Worksheet
Dim esiste As Boolean, v As Variant
For Each v In Array("MISO", "TISO", "CISO")
For Each wrkPagina In Worksheets
Sheets(v).Cells(1, 1) = Application.Sum(Range("M:M"))
Next
Next
End Sub |
Sheets(v).Cells(1, 1) = Application.Sum(Sheets(v).Range("M:M")) |
Sub sommafogli()
Dim wrkPagina As Worksheet
Dim v As Variant
For Each v In Array("FEB", "GEN")
For Each wrkPagina In Worksheets
Sheets(v).Cells(1, 10) = Application.Sum(Sheets(v).Range("J:J"))
Next
Next
End Sub |
