Skip to content

Instantly share code, notes, and snippets.

@drnextgis
Created July 1, 2011 03:55
Show Gist options
  • Save drnextgis/1057840 to your computer and use it in GitHub Desktop.
Save drnextgis/1057840 to your computer and use it in GitHub Desktop.
Reports
Sub reports()
Const DBfile = "c:\personal\sib\operative.xls"
Dim notFillRows(59)
Set fso = CreateObject("Scripting.FileSystemObject")
Set a = CreateObject("excel.application")
Set b = a.Workbooks.Open(DBfile)
Set s = b.Sheets(1)
For rwNumber = 8 To 67
If Cells(rwNumber, 15).Value = 1 Then
For rw2Number = 2 To 61
If Cells(rwNumber, 2).Value = s.Cells(rw2Number, 1).Value Then
If Not s.Cells(rw2Number, 3) Is Nothing Then Cells(rwNumber, 3).Value = CStr(s.Cells(rw2Number, 3).Value)
If Not s.Cells(rw2Number, 4) Is Nothing Then Cells(rwNumber, 6).Value = CStr(s.Cells(rw2Number, 4).Value)
If Not s.Cells(rw2Number, 5) Is Nothing Then Cells(rwNumber, 7).Value = CStr(s.Cells(rw2Number, 5).Value)
If Not s.Cells(rw2Number, 6) Is Nothing Then Cells(rwNumber, 10).Value = CStr(s.Cells(rw2Number, 6).Value)
If Not s.Cells(rw2Number, 7) Is Nothing Then Cells(rwNumber, 11).Value = CStr(s.Cells(rw2Number, 7).Value)
If Not s.Cells(rw2Number, 8) Is Nothing Then Cells(rwNumber, 13).Value = CStr(s.Cells(rw2Number, 8).Value)
If Not s.Cells(rw2Number, 9) Is Nothing Then Cells(rwNumber, 14).Value = CStr(s.Cells(rw2Number, 9).Value)
If Not s.Cells(rw2Number, 10) Is Nothing Then Cells(rwNumber, 20).Value = CStr(s.Cells(rw2Number, 10).Value)
If Not s.Cells(rw2Number, 11) Is Nothing Then Cells(rwNumber, 27).Value = CStr(s.Cells(rw2Number, 11).Value)
If Not s.Cells(rw2Number, 12) Is Nothing Then Cells(rwNumber, 28).Value = CStr(s.Cells(rw2Number, 12).Value)
If Not s.Cells(rw2Number, 13) Is Nothing Then Cells(rwNumber, 29).Value = CStr(s.Cells(rw2Number, 13).Value)
If Not s.Cells(rw2Number, 14) Is Nothing Then Cells(rwNumber, 144).Value = CStr(s.Cells(rw2Number, 14).Value)
If Not s.Cells(rw2Number, 15) Is Nothing Then Cells(rwNumber, 145).Value = CStr(s.Cells(rw2Number, 15).Value)
If Not s.Cells(rw2Number, 16) Is Nothing Then Cells(rwNumber, 146).Value = CStr(s.Cells(rw2Number, 16).Value)
If Not s.Cells(rw2Number, 17) Is Nothing Then Cells(rwNumber, 147).Value = CStr(s.Cells(rw2Number, 17).Value)
If Not s.Cells(rw2Number, 18) Is Nothing Then Cells(rwNumber, 149).Value = CStr(s.Cells(rw2Number, 18).Value)
If Not s.Cells(rw2Number, 19) Is Nothing Then Cells(rwNumber, 150).Value = CStr(s.Cells(rw2Number, 19).Value)
If Not s.Cells(rw2Number, 20) Is Nothing Then Cells(rwNumber, 65).Value = CStr(s.Cells(rw2Number, 20).Value)
If Not s.Cells(rw2Number, 21) Is Nothing Then Cells(rwNumber, 66).Value = CStr(s.Cells(rw2Number, 21).Value)
If Not s.Cells(rw2Number, 22) Is Nothing Then Cells(rwNumber, 67).Value = CStr(s.Cells(rw2Number, 22).Value)
If Not s.Cells(rw2Number, 23) Is Nothing Then Cells(rwNumber, 68).Value = CStr(s.Cells(rw2Number, 23).Value)
If Not s.Cells(rw2Number, 24) Is Nothing Then Cells(rwNumber, 70).Value = CStr(s.Cells(rw2Number, 24).Value)
If Not s.Cells(rw2Number, 25) Is Nothing Then Cells(rwNumber, 69).Value = CStr(s.Cells(rw2Number, 25).Value)
If Not s.Cells(rw2Number, 26) Is Nothing Then Cells(rwNumber, 71).Value = CStr(s.Cells(rw2Number, 26).Value)
If Not s.Cells(rw2Number, 27) Is Nothing Then Cells(rwNumber, 72).Value = CStr(s.Cells(rw2Number, 27).Value)
If Not s.Cells(rw2Number, 28) Is Nothing Then Cells(rwNumber, 74).Value = CStr(s.Cells(rw2Number, 28).Value)
If Not s.Cells(rw2Number, 29) Is Nothing Then Cells(rwNumber, 75).Value = CStr(s.Cells(rw2Number, 29).Value)
If Not s.Cells(rw2Number, 30) Is Nothing Then Cells(rwNumber, 154).Value = CStr(s.Cells(rw2Number, 30).Value)
If Not s.Cells(rw2Number, 31) Is Nothing Then Cells(rwNumber, 155).Value = CStr(s.Cells(rw2Number, 31).Value)
If Not s.Cells(rw2Number, 32) Is Nothing Then Cells(rwNumber, 156).Value = CStr(s.Cells(rw2Number, 32).Value)
If Not s.Cells(rw2Number, 33) Is Nothing Then Cells(rwNumber, 157).Value = CStr(s.Cells(rw2Number, 33).Value)
If Not s.Cells(rw2Number, 34) Is Nothing Then Cells(rwNumber, 158).Value = CStr(s.Cells(rw2Number, 34).Value)
If Not s.Cells(rw2Number, 35) Is Nothing Then Cells(rwNumber, 159).Value = CStr(s.Cells(rw2Number, 35).Value)
If Not s.Cells(rw2Number, 36) Is Nothing Then Cells(rwNumber, 160).Value = CStr(s.Cells(rw2Number, 36).Value)
Cells(rwNumber, 15).Interior.ColorIndex = 19
End If
Next rw2Number
End If
Next rwNumber
b.Close True
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment