jh schrieb am 03.07.2008 17:34:48:
Hallo noch mal,
da bist du ja noch gut dran, wenn du nicht weißt WIE du es machen
sollst ;-) denn mir ist nicht einmal klar WAS du machen sollst. Dein Chef
muss schon mal sagen, was er mit dem "nicht nur für Excel benutzen"
genau meint: WO denn bitteschön - in anderen Office-Programmen? Ganz
woanders? WIE? In welcher Sprache? Wie sollen die Excel-spezifischen
Bezüge aufgelöst werden? Es ist ganz einfach so, erst muss eine KONKRETE
Aufgabenstellung da sein, dann kann man sie algorithmisieren und in einer
Programmiersprache formulieren.
Gruß
Hi, ich habe ihn jetzt feritg du kannst ihn dir ja ma angucken wenn du willst...
Option Explicit
Type myType
DatTime As Date
Position As Long
End Type
Global datFeld() As myType
Sub vervollständigen1()
Dim lngZaehl As Long
Dim lngAnzZeilen As Long
Dim map1
Dim strHilf As String
Set map1 = Worksheets(ActiveSheet.Name)
lngAnzZeilen = map1.UsedRange.Rows.Count
For lngZaehl = 2 To lngAnzZeilen
ReDim Preserve datFeld(lngZaehl)
strHilf = map1.Cells(lngZaehl, 1)
strHilf = Replace(strHilf, ",", "")
strHilf = Replace(strHilf, " Uhr", "")
datFeld(lngZaehl).DatTime = CDate(strHilf)
datFeld(lngZaehl).Position = lngZaehl
Next lngZaehl
Call Sort(datFeld, 1, UBound(datFeld))
For lngZaehl = 2 To lngAnzZeilen
map1.Cells(lngZaehl, 2) = Format(datFeld(lngZaehl).DatTime, "dd.mm.yyyy hh:mm")
map1.Cells(lngZaehl, 3) = Format(datFeld(lngZaehl).DatTime, "dd.mm.yyyy")
map1.Cells(lngZaehl, 4) = Format(datFeld(lngZaehl).DatTime, "hh:mm")
map1.Cells(lngZaehl, 5) = Str(datFeld(lngZaehl).Position)
Next lngZaehl
map1.Cells(1, 1) = "Datum Zeit unsortiert"
map1.Cells(1, 2) = "Datum Zeit sortiert,"
map1.Cells(1, 3) = "Datum getrennt"
map1.Cells(1, 4) = "Uhrzeit getrennt"
map1.Cells(1, 5) = "Ursprungszeile"
End Sub
Function Sort(Wert() As myType, ByVal Start As Integer, ByVal Ende As Integer)
Dim a, Z, Vergleich As myType, Mitte As Integer
Dim X
Dim SwapHelp As myType
'
a = Start
Z = Ende
Mitte = (a + Z) / 2
Vergleich = Wert(Mitte)
Do
While Wert(a).DatTime Vergleich.DatTime
Z = Z - 1
Loop
If a Z
If Start < Z Then
X = Sort(datFeld, Start, Z)
End If
If a < Ende Then
X = Sort(datFeld, a, Ende)
End If
End Function
mfg stein |