Tohle je muj nejlepsi vytvor 7 dni pote, co jsem zjistil, ze existuje VB. Kdyby jste si nekdo vsimnul, ze delam neco zbytecne slozite, byl bych rad za radu.
Sub cteni_data
list_cteni = 1
sloupeccteni = 0
list_zapis = 0
sloupeczapis = 10
radekcteni = 0
radekzapis = 7
sloupecj = 9
sloupecor = 8
max = 0
sloupecstop = 1
radekstop = 6
sloupecmax = 13
sloupeca = 0
radektimea = 10
radektimeb = 11
radektime1a = 23
radektime1b = 24
radektime2a = 33
radektime2b = 34
radektime3a = 43
radektime3b = 44
radekdatea = 6
radekdateb = 7
radekdate1a = 20
radekdate1b = 21
radekdate2a = 30
radekdate2b = 31
radekdate3a = 40
radekdate3b = 41
dokument = ThisComponent
vyber = dokument.currentselection
listcteni = dokument.sheets(list_cteni)
listzapis = dokument.sheets(list_zapis)
bunkastop = listzapis.getcellbyposition(sloupecstop, radekstop)
time1a = listzapis.getcellbyposition(sloupeca, radektime1a)
time1b = listzapis.getcellbyposition(sloupeca, radektime1b)
time2a = listzapis.getcellbyposition(sloupeca, radektime2a)
time2b = listzapis.getcellbyposition(sloupeca, radektime2b)
time3a = listzapis.getcellbyposition(sloupeca, radektime3a)
time3b = listzapis.getcellbyposition(sloupeca, radektime3b)
timea = listzapis.getcellbyposition(sloupeca, radektimea)
timeb = listzapis.getcellbyposition(sloupeca, radektimeb)
date1a = listzapis.getcellbyposition(sloupeca, radekdate1a)
date1b = listzapis.getcellbyposition(sloupeca, radekdate1b)
date2a = listzapis.getcellbyposition(sloupeca, radekdate2a)
date2b = listzapis.getcellbyposition(sloupeca, radekdate2b)
date3a = listzapis.getcellbyposition(sloupeca, radekdate3a)
date3b = listzapis.getcellbyposition(sloupeca, radekdate3b)
datea = listzapis.getcellbyposition(sloupeca, radekdatea)
dateb = listzapis.getcellbyposition(sloupeca, radekdateb)
Do
bunkacteni = listcteni.getcellbyposition(sloupeccteni, radekcteni)
bunkazapis = listzapis.getcellbyposition(sloupeczapis, radekzapis)
bunkaj = listcteni.getcellbyposition(sloupecj, radekcteni)
IF((fix(bunkacteni.value)>datea.value) and (fix(bunkacteni.value)<dateb.value)) Then
if (fix(bunkacteni.value) > fix(bunkazapis.value)) then
bunkazapismax = listzapis.getcellbyposition(sloupecmax, radekzapis)
bunkazapismax.setvalue(max)
max = 0
radekzapis = radekzapis + 1
bunkazapis = listzapis.getcellbyposition(sloupeczapis, radekzapis)
bunkazapis.setvalue(bunkacteni.value)
bunkaor = listzapis.getcellbyposition(sloupecor, radekzapis)
If ((bunkaor.value>date1a.value) and (bunkaor.value<date1b.value) and ((bunkacteni.value-fix(bunkacteni.value))>time1a.value) and ((bunkacteni.value-fix(bunkacteni.value))<time1b.value)) then
if (bunkaj.value > max) then
max = bunkaj.value
end if
Elseif ((bunkaor.value>date2a.value) and (bunkaor.value<date2b.value) and ((bunkacteni.value-fix(bunkacteni.value))>time2a.value) and ((bunkacteni.value-fix(bunkacteni.value))<time2b.value)) then
if (bunkaj.value > max) then
max = bunkaj.value
end if
Elseif ((bunkaor.value>date3a.value) and (bunkaor.value<date3b.value) and ((bunkacteni.value-fix(bunkacteni.value))>time3a.value) and ((bunkacteni.value-fix(bunkacteni.value))<time3b.value)) then
if (bunkaj.value > max) then
max = bunkaj.value
end if
Else
if ((bunkacteni.value-fix(bunkacteni.value)>timea.value) and (bunkacteni.value-fix(bunkacteni.value)<timeb.value)) then
if (bunkaj.value > max) then
max = bunkaj.value
end if
end if
End if
else
If ((bunkaor.value>date1a.value) and (bunkaor.value<date1b.value) and ((bunkacteni.value-fix(bunkacteni.value))>time1a.value) and ((bunkacteni.value-fix(bunkacteni.value))<time1b.value)) then
if (bunkaj.value > max) then
max = bunkaj.value
end if
Elseif ((bunkaor.value>date2a.value) and (bunkaor.value<date2b.value) and ((bunkacteni.value-fix(bunkacteni.value))>time2a.value) and ((bunkacteni.value-fix(bunkacteni.value))<time2b.value)) then
if (bunkaj.value > max) then
max = bunkaj.value
end if
Elseif ((bunkaor.value>date3a.value) and (bunkaor.value<date3b.value) and ((bunkacteni.value-fix(bunkacteni.value))>time3a.value) and ((bunkacteni.value-fix(bunkacteni.value))<time3b.value)) then
if (bunkaj.value > max) then
max = bunkaj.value
end if
Else
if ((bunkacteni.value-fix(bunkacteni.value)>timea.value) and (bunkacteni.value-fix(bunkacteni.value)<timeb.value)) then
if (bunkaj.value > max) then
max = bunkaj.value
end if
end if
End if
end if
END IF
radekcteni = radekcteni + 1
loop until radekcteni = 65536 or bunkastop.value = 1
msgbox "Ufffffffff. To byla ale drina. ",10,"Hotovo"
bunkastop.setvalue(0)
End Sub
Sub vynulovat
listt = 0
radekk = 8
sloupec1 = 10
sloupec2 = 13
dokument = ThisComponent
vyber = dokument.currentselection
list = dokument.sheets(listt)
radekz = 373
Do
radekz = radekz - 1
bunka_erase = list.getCellbyposition(sloupec1, radekz)
bunka_erase.setvalue(0)
Loop Until radekz = radekk
radekz = 373
Do
radekz = radekz - 1
bunka_erase2 = list.getCellbyposition(sloupec2, radekz)
bunka_erase2.setvalue(0)
Loop Until radekz = radekk
msgbox "Cisto",10,""
End Sub
Sub stp
listt = 0
sloupecstop = 1
radekstop = 6
dokument = ThisComponent
vyber = dokument.currentselection
list = dokument.sheets(listt)
bunkastop = list.getcellbyposition(sloupecstop, radekstop)
bunkastop.setvalue(1)
End Sub