Hallo ihr Excelprofis
gibt es überhaupt eine Möglichkeit Zeiten über 24 Stunden darzustellen
Sub Zeiten()
for x=6 to 100
var = var + cells(x,2)
next x
msgbox x
End Sub
im Voraus vielen Dank
mfg Ulf
Hallo
wenn du damit nicht unbedingt weiterrechnen willst
Das ist die Tabelle
A
1
9.00 h
2
12.00 h
3
12.00 h
4
12.00 h
5
12.00 h
und das der Code dazu OptionExplicit
Sub DemoTime() Dim i AsInteger Dim tmpTime As Date For i = 1 To 5 tmpTime = tmpTime + Cells(i, 1).Value Next i MsgBox Format(Int(tmpTime * 24), "00") & ":" & Format(Int((tmpTime * 24) - Int(tmpTime * 24)) * 60, "00") & " Stunden" EndSub
Gruss Rainer
Anzeige
AW: msgbox Format [hh]:mm
10.04.2006 23:59:39
Erich
Hallo Ulf,
oder so:
Option Explicit
Sub Zeiten()
Dim zz As Long, tmpTime As Date
Const korr = 0.00000000000001
For zz = 6 To 100
tmpTime = tmpTime + Cells(zz, 2)
Next zz
MsgBox Int(tmpTime * 24 + korr) & Format(tmpTime, ":nn") & " Stunden"
' oder so:
MsgBox Format(Int(tmpTime * 24 + korr), "00") & ":" & _
Format((tmpTime * 24 + korr - Int(tmpTime * 24 + korr)) * 60, "00") & " Stunden"
End Sub
Rückmeldung wäre nett! - Grüße von Erich aus Kamp-Lintfort
AW: msgbox Format [hh]:mm
10.04.2006 23:38:13
PeterW
Hallo Ulf,
hab hier keine Version 8, mit 2003 geht es beispielsweise so:
MsgBox Int(var) * 24 + Hour(var) & ":" & Minute(var)
Gruß
Peter
Anzeige
AW: msgbox Format [hh]:mm
11.04.2006 09:08:20
Erich
Hi Ulf,
ich hab noch mal ein paar Formeln aufgeschrieben und getestet:
Diagramm - Grafik - Excel Tabellen einfach im Web darstellen Excel Jeanie HTML 3.0 Download
Die erzeugen in vier Beispielen folgende Ausgaben:
B
C
D
E
F
1
Summanden
Ausgabe
Formel
ok
2
20:20:00
60:00 Std
1
3
20:20:00
61:00 Std
2
ja
4
20:20:00
61:00 Std
3
ja
5
60:00 Std
4
6
61:00 Std
5
ja
7
61:0 Std
6
8
61:00 Std
7
ja
9
10
1:01:00
01:00 Std
1
11
01:01 Std
2
ja
12
1:01 Std
3
fast
13
01:01 Std
4
ja
14
01:01 Std
5
ja
15
1:1 Std
6
16
1:01 Std
7
fast
17
18
1:10:00
01:00 Std
1
19
01:10 Std
2
ja
20
1:10 Std
3
fast
21
01:10 Std
4
ja
22
01:10 Std
5
ja
23
1:10 Std
6
fast
24
1:10 Std
7
fast
25
26
1:01:30
01:00 Std
1
27
01:02 Std
2
ja
(gerundet)
28
1:01 Std
3
fast
(abgerundet)
29
01:01 Std
4
ja
(abgerundet)
30
01:01 Std
5
ja
(abgerundet)
31
1:1 Std
6
32
1:01 Std
7
fast
(abgerundet)
Diagramm - Grafik - Excel Tabellen einfach im Web darstellen Excel Jeanie HTML 3.0 Download
Die Ausgabe [hh]:mm wird nur bei den Formeln 2 und 5 erzeugt.
Die Prozedur dazu ist in der Mappe https://www.herber.de/bbs/user/32762.xls
Rückmeldung wäre nett! - Grüße von Erich aus Kamp-Lintfort
Anzeige
AW: msgbox Format [hh]:mm
11.04.2006 15:54:38
Ulf
Hallo Rainer
Hallo Erich
Hallo Peter
Die Lösungen sind alle ganz interressant
Weiterrechnen wollte ich mit Summen nicht, das kann ich ja schon vorher in Vba
Ich wollte nur die Ausgabe der Daten Formatieren.
Danke an euch allen
Entschuldigung das meine Antwort so lange gedauert hat.
mfg Ulf