snasui.com ยินดีต้อนรับ ยินดีต้อนรับสู่กระดานถามตอบ Excel and VBA และอื่น ๆ ที่เป็นมิตรกับทุกท่าน มีไฟล์แนบมหาศาล ช่วยให้ท่านค้นหาและติดตามศึกษาได้โดยง่าย สมาชิกท่านใดที่ยังไม่ได้ระบุ Version ของ Excel ที่ใช้งานจริง สามารถทำตาม Link นี้เพื่อจะได้รับคำตอบที่ตรงกับ Version ของท่านครับ ระบุ Version ของ Excel
Private Sub Worksheet_Change(ByVal Target As Range)
Dim cell As Range
Application.EnableEvents = False
For Each cell In Target
If Not Application.Intersect(cell, Range("InputC_RunN")) Is Nothing Then
If Not IsNumeric(cell.Value) Then
cell.Value = vbNullString
End If
End If
Next cell
Application.EnableEvents = True
If Not Intersect(Target, [InputC_Y]) Is Nothing Then
If [InputC_Y] <> [MyNow_Y_Sprit] Then Range("InputC_Y").Value = [MyNow_Y_Sprit]
End If
If Not Intersect(Target, [InputC_M]) Is Nothing Then
If [InputC_M] <> [MyNow_M] Then Range("InputC_M").Value = [MyNow_M]
End If
If Not Intersect(Target, [InputC_RunN]) Is Nothing Then
Application.EnableEvents = False
Range("InputC_RunN") = Replace([InputC_RunN], "+", "")
If [InputC_RunN] > 9999 Then
Range("InputC_RunN") = Range("InputC_RunN") + 1
End If
If [InputC_RunN] = 0 Then
Range("InputC_RunN") = Range("InputC_RunN") + 1
End If
Call PadRunN
Range("InputC_RunN") = [InputC_RunN]
Application.EnableEvents = True
End If
End Sub
Private Sub CommandButton1_Click()
Dim nameSvFile As String
Dim PathDir As String
Dim strFileExists As String
PathDir = ThisWorkbook.Path & "\"
nameSvFile = PathDir & [SetName4NewFile] & ".xlsm"
strFileExists = PathDir & [SetName4NewFile] & "*"
If Dir(strFileExists) <> "" Then
MsgBox "หมายเลขนี้ถูกสร้างแล้ว กรุณาเลือกหมายเลขใหม่ !"
Range("InputC_RunN") = Range("InputC_RunN") + 1
Else
Range("InputC_RunN") = Range("InputC_RunN") + 1
MsgBox "สร้างไฟล์ " & nameSvFile & " สำเร็จ"
End If
End Sub
You do not have the required permissions to view the files attached to this post.