
Sub Estrazione_generale()
Dim wbk_1 As Workbook
Dim fso As Object
Dim my_range_1 As Range
Dim my_range_2 As Range
Dim my_range_3 As Range
Dim Cella As Range
Dim Cella_1 As Range
'Dim Riga As Long
Set wbk_1 = ThisWorkbook
Set fso = CreateObject("Scripting.FileSystemObject")
Set my_range_1 = wbk_1.Sheets("Generale").Range("B4:B20000").SpecialCells(xlCellTypeConstants)
Set my_range_3 = wbk_1.Sheets("Generale").Range("d2:BBB2").SpecialCells(xlCellTypeConstants)
For Each Cella In my_range_1
Set my_range_2 = wbk_1.Sheets(Trim(Cella)).Range("d16:d2000").SpecialCells(xlCellTypeConstants)
|
Function sheet_exists(s As String) As Boolean
Dim ws As Worksheet
sheet_exists = False
For Each ws In ThisWorkbook.Worksheets
If LCase(ws.Name) = LCase(s) Then sheet_exists = True: Exit Function
Next
End Function |
For Each ws In wbk_1.Worksheets |
For Each Cella In my_range_1 |
| scossa's web site |
| Se tu hai una mela, ed io ho una mela, e ce le scambiamo, allora tu ed io abbiamo sempre una mela per uno. Ma se tu hai un'idea, ed io ho un'idea, e ce le scambiamo, allora abbiamo entrambi due idee. (George Bernard Shaw) |
Sub Estrazione_generale()
Dim wbk_1 As Workbook
Dim fso As Object
Dim my_range_1 As Range
Dim my_range_2 As Range
Dim my_range_3 As Range
Dim range_a As Range
Dim range_a_row As Integer
Dim range_a_column As Integer
Dim range_b_row As Integer
Dim range_b_column As Integer
Dim Cella As Range
Dim Cella_1 As Range
Dim Cella_2 As Double
Dim sWsName As String
Dim sWs As String
Dim ws As Worksheet
Set wbk_1 = ThisWorkbook
Set fso = CreateObject("Scripting.FileSystemObject")
Set my_range_1 = wbk_1.Sheets("Generale").Range("B4:B20000").SpecialCells(xlCellTypeConstants)
Set my_range_3 = wbk_1.Sheets("Generale").Range("d2:BBB2").SpecialCells(xlCellTypeConstants)
For Each ws In wbk_1.Worksheets
sWs = sWs & "#" & ws.Name
Next
sWs = sWs & "#"
For Each Cella In my_range_1
sWsName = Trim(Cella.Value)
If InStr(1, sWs, "#" & sWsName & "#", vbTextCompare) > 0 Then
Set my_range_2 = wbk_1.Sheets(sWsName).Range("d16:d2000").SpecialCells(xlCellTypeConstants)
End If
'Set my_range_2 = wbk_1.Sheets(Trim(Cella)).Range("d16:d2000").SpecialCells(xlCellTypeConstants)
With my_range_2
For Each Cella_1 In my_range_3
Set range_a = .Find(what:=Cella_1, LookIn:=xlValues)
If Not range_a Is Nothing Then
range_a_row = range_a.Row
range_a_column = range_a.Column
range_b_row = Cella_1.Row
range_b_column = Cella_1.Column
Cella_2 = wbk_1.Sheets(Trim(Cella)).Range("h" & range_a_row)
wbk_1.Sheets("Generale").Cells(Cella.Row, range_b_column) = Cella_2
End If
Next
End With
Next
End Sub
|
Sub Estrazione_generale()
Dim wbk_1 As Workbook
Dim fso As Object
Dim my_range_1 As Range
Dim my_range_2 As Range
Dim my_range_3 As Range
Dim range_a As Range
Dim range_a_row As Integer
Dim range_a_column As Integer
Dim range_b_row As Integer
Dim range_b_column As Integer
Dim Cella As Range
Dim Cella_1 As Range
Dim Cella_2 As Double
Dim wSheet As Worksheet
Set wbk_1 = ThisWorkbook
Set fso = CreateObject("Scripting.FileSystemObject")
Set my_range_1 = wbk_1.Sheets("Generale").Range("B4:B20000").SpecialCells(xlCellTypeConstants)
Set my_range_3 = wbk_1.Sheets("Generale").Range("d2:BBB2").SpecialCells(xlCellTypeConstants)
For Each Cella In my_range_1
On Error Resume Next
Set wSheet = Sheets(Trim(Cella))
If Not wSheet Is Nothing Then
Set my_range_2 = wbk_1.Sheets(Trim(Cella)).Range("d16:d2000").SpecialCells(xlCellTypeConstants)
With my_range_2
For Each Cella_1 In my_range_3
Set range_a = .Find(what:=Cella_1, LookIn:=xlValues)
If Not range_a Is Nothing Then
range_a_row = range_a.Row
range_a_column = range_a.Column
range_b_row = Cella_1.Row
range_b_column = Cella_1.Column
Cella_2 = wbk_1.Sheets(Trim(Cella)).Range("h" & range_a_row)
wbk_1.Sheets("Generale").Cells(Cella.Row, range_b_column) = Cella_2
End If
Next
End With
End If
Next
End Sub
|
| scossa's web site |
| Se tu hai una mela, ed io ho una mela, e ce le scambiamo, allora tu ed io abbiamo sempre una mela per uno. Ma se tu hai un'idea, ed io ho un'idea, e ce le scambiamo, allora abbiamo entrambi due idee. (George Bernard Shaw) |
If InStr(1, sWs, "#" & sWsName & "#", vbTextCompare) > 0 Then
Set my_range_2 = wbk_1.Sheets(sWsName).Range("d16:d2000").SpecialCells(xlCellTypeConstants)
With my_range_2
'........
End With
'........
End If |
If InStr(1, sWs, "#" & sWsName & "#", vbTextCompare) > 0 Then
Set my_range_2 = wbk_1.Sheets(sWsName).Range("d16:d2000")
With my_range_2
'........
End With
'........
End If
|
