vba code for cutoff time

Option Explicit

Sub stripTime()
    Dim i As Integer
    With Worksheets("Sheet1")
        'check to see if A1 is a date or a column text label
        i = Abs(Not IsDate(.Cells(1, 1).Value))
        With .Range(.Cells(1 + i, "A"), .Cells(.Rows.Count, "A").End(xlUp))
            .TextToColumns Destination:=.Cells(1, "C"), DataType:=xlFixedWidth, _
                           FieldInfo:=Array(Array(0, xlDMYFormat), Array(10, xlSkipColumn))
            'optionally assign a custom number format
            .Offset(0, 2).NumberFormat = "[color10]dd-mmm-yyyy_)"
            'optionally autofit the column width
            .Offset(0, 2).EntireColumn.AutoFit
        End With
    End With
End Sub

Are there any code examples left?
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source