Hi Guys
I have recorded some VBA code to convert dates into their number format. The code works with the first Column but fails while doing the second Column.
I discovered that the reason was that the Column F had blank cells and for some reasons it does not like that.
Can somebody help me with this please
I have recorded some VBA code to convert dates into their number format. The code works with the first Column but fails while doing the second Column.
I discovered that the reason was that the Column F had blank cells and for some reasons it does not like that.
Can somebody help me with this please
VBA Code:
Sub Desp()
'
' Desp Macro
'
Range("E3").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.TextToColumns Destination:=Range("E3"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
:=Array(1, 4), TrailingMinusNumbers:=True
Range("F3").Select
Range("F3").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.TextToColumns Destination:=Range("F3"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
:=Array(1, 4), TrailingMinusNumbers:=True
Selection.NumberFormat = "m/d/yyyy"
End Sub
Perry Hill Territory Spreadsheet.xlsm | ||||
---|---|---|---|---|
E | F | |||
2 | Assigned | Returned | ||
3 | 14/05/2016 | 25/06/2016 | ||
4 | 08/05/2016 | 19/08/2016 | ||
5 | 11/07/2016 | 26/12/2016 | ||
6 | 03/08/2017 | 26/03/2017 | ||
7 | 26/03/2017 | 07/05/2017 | ||
8 | 29/07/2017 | 15/10/2017 | ||
9 | 02/10/2018 | |||
10 | 21/07/2018 | 28/07/2018 | ||
11 | 11/01/2018 | 03/01/2019 | ||
12 | 19/01/2019 | 25/02/2019 | ||
13 | 04/03/2019 | 18/04/2019 | ||
14 | 28/06/2019 | 28/07/2019 | ||
15 | 09/07/2019 | 18/09/2019 | ||
16 | 12/12/2019 | 04/01/2020 | ||
17 | 26/09/2020 | 06/12/2020 | ||
18 | 19/09/2021 | |||
19 | 22/04/2016 | 08/07/2016 | ||
20 | 08/06/2016 | 14/08/2016 | ||
21 | 10/03/2016 | 03/12/2016 | ||
22 | 21/01/2017 | 15/03/2017 | ||
23 | 29/03/2017 | 02/04/2017 | ||
24 | 05/12/2017 | 18/06/2017 | ||
25 | 22/07/2017 | 30/07/2017 | ||
26 | 09/02/2017 | 06/10/2017 | ||
27 | 12/06/2017 | 15/01/2018 | ||
28 | 16/05/2018 | 25/05/2018 | ||
29 | 28/07/2018 | 04/08/2018 | ||
30 | 13/10/2018 | 25/11/2018 | ||
31 | 02/09/2019 | 20/02/2019 | ||
32 | 23/03/2019 | 15/04/2019 | ||
33 | 20/06/2019 | 24/07/2019 | ||
34 | 14/08/2019 | 15/08/2019 | ||
35 | 10/04/2019 | 06/10/2019 | ||
36 | 12/11/2019 | 23/12/2019 | ||
37 | 03/07/2020 | 13/03/2020 | ||
Sheet1 |