Onderstaande macro zou ik graag willen aanpassen zodat de eerste kolom een datumopmaak heeft.
mvg
Kasper
Code:
Sub sg()
Dim myArrB() As Variant ' Array to be used for FieldInfo
Dim iItem As Long ' Counter for Fields in FieldInfo
Dim myArrayTemp() As Variant ' Temporary Array used for Arrays inside of FieldInfo Array
Dim myFields As Long ' Variable to hold number of fields we want to setup
myFields = 20 ' Number of fields we want.
myFields = myFields - 1 ' Zero Based - This is for the array index. subtract 1
' Create a Jagged Array that is required by TextToColumns
' -------------------------------------------------------
ReDim myArrB(0 To myFields) ' Redimension the Array to the number of fields
For iItem = 0 To myFields ' Loop through each field
ReDim myArrayTemp(0 To 1) ' Redimension the Array inside the FieldInfo Array
myArrayTemp(0) = iItem + 1 ' iItem is the field number
myArrayTemp(1) = 2 ' xlTextFormat DataType
myArrB(iItem) = myArrayTemp ' Build the FileInfo Array by storing the Array inside the Array
Next iItem
' -------------------------------------------------------
Columns("A:A").Select
Selection.TextToColumns Destination:=Range("A1"), DataType:=xlFixedWidth, _
TextQualifier:=xlNone, ConsecutiveDelimiter:=False, Tab:=False, _
Semicolon:=True, Comma:=False, Space:=False, Other:=True, OtherChar _
:="|", FieldInfo:=myArrB, TrailingMinusNumbers:=True
End Sub
mvg
Kasper