Code:
Case "CENTRALIZATOR SURVEY"
Dim SHT As Object
Set SHT = Application.ThisWorkbook.Sheets("CENTRALIZATOR SURVEY")
SHT.Cells(10, 1) = UCase(n)
If IsEmpty(SHT.Cells(11, 1)) = False Then
Do
Range(SHT.Cells(11, 1), Cells(11, 8)).Select
Selection.EntireRow.Delete
Set SHT = Nothing
Loop Until IsEmpty(SHT.Cells(11, 1))
End If
nr_crt = 0
suma = 0
For i = 5 To 184
For j = 3 To 6
Select Case ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(i, j).Value
Case "SURVEY S1"
Set SHT = Application.ThisWorkbook.Sheets("CENTRALIZATOR SURVEY")
nr_crt = nr_crt + 1
suma = suma + 5
For k = 10 To 10 + nr_crt
If ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(1, 3).Value = ThisWorkbook.Sheets("CENTRALIZATOR SURVEY").Cells(k, 1).Value Then
Range(SHT.Cells(k + nr_crt, 1), Cells(k + nr_crt, 8)).Select
Selection.EntireRow.Copy
Selection.Insert
Application.CutCopyMode = False
SHT.Cells(k + nr_crt, 1).Value = nr_crt
SHT.Cells(k + nr_crt, 2).Value = ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(i, j + 1).Value
SHT.Cells(k + nr_crt, 3).Value = ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(i, j + 2).Value
SHT.Cells(k + nr_crt, 4).Value = ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(i, j + 3).Value
SHT.Cells(k + nr_crt, 5).Value = "S1"
End If
Next k
Set SHT = Nothing
Case "SURVEY S2"
Set SHT = Application.ThisWorkbook.Sheets("CENTRALIZATOR SURVEY")
nr_crt = nr_crt + 1
suma = suma + 40
For k = 10 To 10 + nr_crt
If ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(1, 3).Value = SHT.Cells(k, 1).Value Then
Range(SHT.Cells(k + nr_crt, 1), Cells(k + nr_crt, 8)).Select
Selection.EntireRow.Copy
Selection.Insert
Application.CutCopyMode = False
SHT.Cells(k + nr_crt, 1).Value = nr_crt
SHT.Cells(k + nr_crt, 2).Value = ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(i, j + 1).Value
SHT.Cells(k + nr_crt, 3).Value = ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(i, j + 2).Value
SHT.Cells(k + nr_crt, 4).Value = ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(i, j + 3).Value
SHT.Cells(k + nr_crt, 5).Value = "S2"
End If
Next k
Set SHT = Nothing
Case "ALTE SERVICII"
Set SHT = Application.ThisWorkbook.Sheets("CENTRALIZATOR SURVEY")
nr_crt = nr_crt + 1
suma = suma + 10
For k = 10 To 10 + nr_crt
If ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(1, 3).Value = SHT.Cells(k, 1).Value Then
Range(SHT.Cells(k + nr_crt, 1), Cells(k + nr_crt, 8)).Select
Selection.EntireRow.Copy
Selection.Insert
Application.CutCopyMode = False
SHT.Cells(k + nr_crt, 1).Value = nr_crt
SHT.Cells(k + nr_crt, 2).Value = ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(i, j + 1).Value
SHT.Cells(k + nr_crt, 3).Value = ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(i, j + 2).Value
SHT.Cells(k + nr_crt, 4).Value = ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(i, j + 3).Value
SHT.Cells(k + nr_crt, 5).Value = "A"
End If
Next k
Set SHT = Nothing
Case "RECUPERARE"
Set SHT = Application.ThisWorkbook.Sheets("CENTRALIZATOR SURVEY")
nr_crt = nr_crt + 1
suma = suma + 20
For k = 10 To 10 + nr_crt
If ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(1, 3).Value = SHT.Cells(k, 1).Value Then
Range(SHT.Cells(k + nr_crt, 1), Cells(k + nr_crt, 8)).Select
Selection.EntireRow.Copy
Selection.Insert
Application.CutCopyMode = False
SHT.Cells(k + nr_crt, 1).Value = nr_crt
SHT.Cells(k + nr_crt, 2).Value = ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(i, j + 1).Value
SHT.Cells(k + nr_crt, 3).Value = ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(i, j + 2).Value
SHT.Cells(k + nr_crt, 4).Value = ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(i, j + 3).Value
SHT.Cells(k + nr_crt, 5).Value = "D"
End If
Next k
Set SHT = Nothing
End Select
Set SHT = Application.ThisWorkbook.Sheets("CENTRALIZATOR SURVEY")
SHT.Cells(nr_crt + 13, 6).Value = suma
Set SHT = Nothing
Next j
Next i
Bookmarks