I am trying to convert a series of dates from text to 'Date' format, that are in column B on the 'Master' sheet.
I created a macro but I want to run it from any Worksheet rather than being on the Master worksheet. However, the error code 'Subscript out of range' keeps showing up, highlighting With Sheets("sh2"). The code I have so far is:
Sub DateFormatUpdate()
    DateFormatUpdate Macro
    Updates the format of the dates in the master data sheet from 'General' to 'Date'
    Dim sh2 As Worksheet
    Set sh2 = ActiveWorkbook.Sheets("Master")
    With Sheets("sh2")
    Range("B2").Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.TextToColumns Destination:=Range("B2"), DataType:=xlDelimited, _
        TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=False, _
        Semicolon:=False, Comma:=False, Space:=True, Other:=False, FieldInfo _
        :=Array(1, 5), TrailingMinusNumbers:=True
    Range("C2").Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.TextToColumns Destination:=Range("C2"), DataType:=xlDelimited, _
        TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=False, _
        Semicolon:=False, Comma:=False, Space:=True, Other:=False, FieldInfo _
        :=Array(1, 5), TrailingMinusNumbers:=True
    Range("R9").Select
    End With
End Sub
I'm quite new with VBA so my apologies if this is actually an easy problem! Thank you for the help!
 
     
    