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
Dim intRows As Integer
Private Sub btnAdd_Click()
Cells(intRows, 3).Value = txtCode.Text
Cells(intRows, 4).Value = txtName.Text
Cells(intRows, 5).Value = txtGdescription.Text
Cells(intRows, 6).Value = txtTcargoes.Text
Cells(intRows, 7).Value = "K." + txtContact1.Text
Cells(intRows, 8).Value = txtPhone1.Text
Cells(intRows, 9).Value = "K." + txtContact2.Text
Cells(intRows, 10).Value = txtPhone2.Text
Cells(intRows, 11).Value = "K." + txtContact3.Text
Cells(intRows, 12).Value = txtPhone3.Text
Range(Cells(intRows, 3), Cells(intRows, 4), Cells(intRows, 5), Cells(intRows, 6), Cells(intRows, 7), Cells(intRows, 8), Cells(intRows, 9), Cells(intRows, 10), Cells(intRows, 11), Cells(intRows, 12)).Font.Name = "Angsana New"
Range(Cells(intRows, 3), Cells(intRows, 4), Cells(intRows, 5), Cells(intRows, 6), Cells(intRows, 7), Cells(intRows, 8), Cells(intRows, 9), Cells(intRows, 10), Cells(intRows, 11), Cells(intRows, 12)).Font.Size = 12
Range(Cells(intRows, 3), Cells(intRows, 4), Cells(intRows, 5), Cells(intRows, 6), Cells(intRows, 7), Cells(intRows, 8), Cells(intRows, 9), Cells(intRows, 10), Cells(intRows, 11), Cells(intRows, 12)).Font.Bold = True
Range(Cells(intRows, 3), Cells(intRows, 4), Cells(intRows, 5), Cells(intRows, 6), Cells(intRows, 7), Cells(intRows, 8), Cells(intRows, 9), Cells(intRows, 10), Cells(intRows, 11), Cells(intRows, 12)).Borders.LineStyle = xlContinuous
Range(Cells(intRows, 3), Cells(intRows, 4), Cells(intRows, 5), Cells(intRows, 6), Cells(intRows, 7), Cells(intRows, 8), Cells(intRows, 9), Cells(intRows, 10), Cells(intRows, 11), Cells(intRows, 12)).Borders.Weight = xlThin
Range(Cells(intRows, 3), Cells(intRows, 4), Cells(intRows, 5), Cells(intRows, 6), Cells(intRows, 7), Cells(intRows, 8), Cells(intRows, 9), Cells(intRows, 10), Cells(intRows, 11), Cells(intRows, 12)).HorizontalAlignment = xlHAlignCenter
LstData.AddItem (txtCode.Text + txtName.Text + txtGdescription.Text + txtTcargoes.Text + "K." + txtContact1 + txtPhone1.Text + "K." + txtContact2 + txtPhone2.Text + "K." + txtContact3 + txtPhone3.Text)
intRows = intRows + 1
txtCode.Text = ""
txtName.Text = ""
txtGdescription.Text = ""
txtTcargoes.Text = ""
txtContact1.Text = ""
txtPhone1.Text = ""
txtContact2.Text = ""
txtPhone2.Text = ""
txtContact3.Text = ""
txtPhone3.Text = ""
End Sub
Private Sub btnClose_Click()
frmCustomer.Hide
End Sub
Private Sub btnSetsheet_Click()
intRows = 1
Range("A1:J1").Merge
Cells(intRows, 1).Value = "ÃÒª×èÍÅÙ¡¤éÒ"
Cells(intRows, 1).Interior.Color = vbGreen
intRows = intRows + 1
Cells(intRows, 1).Value = "ÃËÑÊÅÙ¡¤éÒ"
Cells(intRows, 1).Interior.Color = vbYellow
Cells(intRows, 2).Value = "ª×èÍÅÙ¡¤éÒ"
Cells(intRows, 2).Interior.Color = vbYellow
Cells(intRows, 3).Value = "ÃÒÂÅÐàÍÕ´ÊÔ¹¤éÒ"
Cells(intRows, 3).Interior.Color = vbYellow
Cells(intRows, 4).Value = "»ÃÐàÀ·ÊÔ¹¤éÒ"
Cells(intRows, 4).Interior.Color = vbYellow
Cells(intRows, 5).Value = "ª×èͼÙéµÔ´µèÍ (1)"
Cells(intRows, 5).Interior.Color = vbYellow
Cells(intRows, 6).Value = "àºÍÃìµÔ´µèÍ (1)"
Cells(intRows, 6).Interior.Color = vbYellow
Cells(intRows, 7).Value = "ª×èͼÙéµÔ´µèÍ (2)"
Cells(intRows, 7).Interior.Color = vbYellow
Cells(intRows, 8).Value = "àºÍÃìµÔ´µèÍ (2)"
Cells(intRows, 8).Interior.Color = vbYellow
Cells(intRows, 9).Value = "ª×èͼÙéµÔ´µèÍ (3)"
Cells(intRows, 9).Interior.Color = vbYellow
Cells(intRows, 10).Value = "àºÍÃìµÔ´µèÍ (3)"
Cells(intRows, 10).Interior.Color = vbYellow
Range("A1:J1").Font.Name = "Angsana New"
Range("A1:J1").Font.Size = 18
Range("A1:J1").Font.Bold = True
Range("A2:J2").Font.Name = "Angsana New"
Range("A2:J2").Font.Size = 14
Range("A2:J2").Font.Bold = True
Range("A1:J1").Borders.LineStyle = xlContinuous
Range("A1:J1").Borders.Weight = xlThin
Range("A2:J2").Borders.LineStyle = xlContinuous
Range("A2:J2").Borders.Weight = xlThin
Range("A1:J1").HorizontalAlignment = xlHAlignCenter
Range("A2:J2").HorizontalAlignment = xlHAlignCenter
intRows = intRows + 1
End Sub
Private Sub lblHeader_Click()
End Sub
Private Sub UserForm_Click()
End Sub
Code: Select all
Private Sub btnAdd_Click()
intRows = Sheets("ข้อมูลลูกค้า").Range("a" & Rows.Count).End(xlUp).Row + 1
Cells(intRows, 1).Value = txtCode.Text
Cells(intRows, 2).Value = txtName.Text
Cells(intRows, 3).Value = txtGdescription.Text
Cells(intRows, 4).Value = txtTcargoes.Text
Cells(intRows, 5).Value = "K." + txtContact1.Text
Cells(intRows, 6).Value = txtPhone1.Text
Cells(intRows, 7).Value = "K." + txtContact2.Text
Cells(intRows, 8).Value = txtPhone2.Text
Cells(intRows, 9).Value = "K." + txtContact3.Text
Cells(intRows, 10).Value = txtPhone3.Text
With Cells(intRows, 1).Resize(, 10)
.Font.Name = "Angsana New"
.Font.Size = 12
.Font.Bold = True
.Borders.LineStyle = xlContinuous
.Borders.Weight = xlThin
.HorizontalAlignment = xlHAlignCenter
End With
LstData.AddItem (txtCode.Text + txtName.Text + txtGdescription.Text + txtTcargoes.Text + "K." + txtContact1 + txtPhone1.Text + "K." + txtContact2 + txtPhone2.Text + "K." + txtContact3 + txtPhone3.Text)
' intRows = intRows + 1
txtCode.Text = ""
txtName.Text = ""
txtGdescription.Text = ""
txtTcargoes.Text = ""
txtContact1.Text = ""
txtPhone1.Text = ""
txtContact2.Text = ""
txtPhone2.Text = ""
txtContact3.Text = ""
txtPhone3.Text = ""
End Sub