をすべての日付を変換していない私が持っている問題があることである新しい列への値を分割し、日付エクセルVBA次のスクリプトが正しく
Dim StartString As String
Dim DateValue As String
Dim y As Integer
Dim LastRow2 As Long
With Sheets("DataSheet")
LastRow2 = .Cells(.Rows.Count, "L").End(xlUp).Row 'find the last row on column L
.Columns(13).Insert Shift:=xlToRight 'add a new column to the right of column L
For i = 1 To LastRow2 'loop through rows
If InStr(1, .Cells(i, "L"), ",") Then
.Cells(i, "M").Value = Split(.Cells(i, "L"), ",")(1) 'split after comma
StartString = .Cells(i, "L").Value
DateValue = ""
For y = 1 To Len(StartString) 'loop to remove unwanted characters
Select Case Asc(Mid(StartString, y, 1))
Case 47 To 57
DateValue = DateValue & Mid(StartString, y, 1)
End Select
Next y
.Cells(i, "M").Value = DateValue 'return the date
.Cells(i, "M").NumberFormat = "dd/mm/yyyy" 'format it correctly
End If
Next i
End With
にテキストを変換するために私を助けている別の質問から次のスクリプトを持っていますすべての場合に変換が成功しません。これは、新しい日付を時系列で並べ替える必要がある列ヘッダーとして使用するため、コードの次の段階で問題を引き起こします。どんな助けもありがとう!
以下も同様です(入力エラーとして黄色のセルは無視してください) 緑色のセルは正常に変換されたようですが、他の多くのセルは左上に小さな緑色のエラーインジケータが表示されていますコーナー。 :
Tiberius Claudius Neroがローマ帝国を支配し、実際に「マイルストーン」が石だった時からの日付があるようです。 – MarcinSzaleniec