EXCEL TOOLS
Excel Add-ins ที่พัฒนาโดยคุณสันติพงศ์ ณสุย (MVP Excel 2010-2020) ด้วยภาษา C# เพื่อแก้ไขปัญหาไฟล์ใหญ่ คำนวณนาน ทำงานช้า จัดการข้อมูลต่าง ๆ ที่ทำงานประจำวันได้อย่างสะดวกรวดเร็ว สนใจคลิกไปดูได้ที่นี่ครับ => Excel Tools
Excel Add-ins ที่พัฒนาโดยคุณสันติพงศ์ ณสุย (MVP Excel 2010-2020) ด้วยภาษา C# เพื่อแก้ไขปัญหาไฟล์ใหญ่ คำนวณนาน ทำงานช้า จัดการข้อมูลต่าง ๆ ที่ทำงานประจำวันได้อย่างสะดวกรวดเร็ว สนใจคลิกไปดูได้ที่นี่ครับ => Excel Tools
[code]
และปิดด้วย [/code]
ตัวอย่างเช่น [code]dim r as range[/code]
เพื่อให้แตกต่างจากข้อความทั่วไป สะดวกในการอ่านและทดสอบ (คลิกเพื่อดูตัวอย่าง)Code: Select all
Private Sub CommandButton1_Click()
Dim x, y As Double
x = TextBox1.Text & "%"
y = TextBox2.Text & "%"
Sum = x + y
If Sum < 3 Then
Label2.Caption = 50 & "-" & 60
Label3.Caption = 50 & "-" & 60
Label4.Caption = 50 & "-" & 60
ElseIf Sum > 2.9 Then
Label2.Caption = 30 & "-" & 40
Label3.Caption = 30 & "-" & 40
Label4.Caption = 30 & "-" & 40
End If
If Sum > 4.9 Then
Label2.Caption = 20 & "-" & 30
Label3.Caption = 20 & "-" & 30
Label4.Caption = 20 & "-" & 30
End If
If Sum > 6.9 Then
Label2.Caption = 10 & "-" & 20
Label3.Caption = 10 & "-" & 20
Label4.Caption = 10 & "-" & 20
ElseIf Sum > 8.9 Then
Label2.Caption = 5 & "-" & 10
Label3.Caption = 5 & "-" & 10
Label4.Caption = 5 & "-" & 10
End If
If Sum > 15 Then
Label2.Caption = 1 & "-" & 5
Label3.Caption = 1 & "-" & 5
Label4.Caption = 1 & "-" & 5
End If
End Sub
Code: Select all
Dim x As Double, y As Double
x = Left(TextBox1.Text, Len(TextBox1.Text) - 1)
y = Left(TextBox2.Text, Len(TextBox2.Text) - 1)
Sum = x + y
'...Other code
Code: Select all
'Other Code....
Dim x, y As Double
x = Replace(TextBox1.Text, "%", "")
y = Replace(TextBox2.Text, "%", "")
Sum = x + y
'Other Code....
ขอบคุณมากครับพี่ ได้แล้วครับ แต่ผมติดอีกเรื่องผมก็ไม่รอบคอบ ในกรณีที่เป็น การแยกช่อง แบบไม่รวมนี่ต้องเขียนยังไงหรอครับ สามารถเขียนต่อกันได้เลยหรือไม่ ขอบคุณครับpuriwutpokin wrote: Tue Feb 13, 2018 2:17 pm อีกตัวอย่างโค้ดครับCode: Select all
'Other Code.... Dim x, y As Double x = Replace(TextBox1.Text, "%", "") y = Replace(TextBox2.Text, "%", "") Sum = x + y 'Other Code....
ลองเขียนมาก่อนเลยครับติดตรงไหนมาถามกันต่อครับjullathep wrote: Tue Feb 13, 2018 2:25 pmขอบคุณมากครับพี่ ได้แล้วครับ แต่ผมติดอีกเรื่องผมก็ไม่รอบคอบ ในกรณีที่เป็น การแยกช่อง แบบไม่รวมนี่ต้องเขียนยังไงหรอครับ สามารถเขียนต่อกันได้เลยหรือไม่ ขอบคุณครับpuriwutpokin wrote: Tue Feb 13, 2018 2:17 pm อีกตัวอย่างโค้ดครับCode: Select all
'Other Code.... Dim x, y As Double x = Replace(TextBox1.Text, "%", "") y = Replace(TextBox2.Text, "%", "") Sum = x + y 'Other Code....