snasui.com ยินดีต้อนรับ ยินดีต้อนรับสู่กระดานถามตอบ Excel and VBA และอื่น ๆ ที่เป็นมิตรกับทุกท่าน มีไฟล์แนบมหาศาล ช่วยให้ท่านค้นหาและติดตามศึกษาได้โดยง่าย สมาชิกท่านใดที่ยังไม่ได้ระบุ Version ของ Excel ที่ใช้งานจริง สามารถทำตาม Link นี้เพื่อจะได้รับคำตอบที่ตรงกับ Version ของท่านครับ ระบุ Version ของ Excel
Sub test()
Dim i As Single
For i = 2 To 20
If Cells(i, 1).Value > 1000 And Application.WorksheetFunction.IsNumber(Cells(i, 1).Value) = False Then
'ในส่วนนี้ผมลองใช้การแยก วัน เดือน ออกมาครับ แต่ก็ไม่ได้ผลตามต้องการครับ
Cells(i, 3).Value = Day(Cells(i, 1).Value) & "/" & Month(Cells(i, 1).Value)
End If
Next i
End Sub
You do not have the required permissions to view the files attached to this post.
Sub test()
Dim i As Single
For i = 2 To 20
If Cells(i, 1) > 1000 And IsDate(Cells(i, 1)) = True Then
Cells(i, 3) = "'" & Left(Application.Text(Cells(i, 1), "d/m/yy"), _
Application.Find("/", Application.Text(Cells(i, 1), "d/m/yy")) - 1) & "/" & Month(Cells(i, 1))
End If
Next i
End Sub