baquang1984
Thành viên tiêu biểu

- Tham gia
- 3/6/10
- Bài viết
- 429
- Được thích
- 44
- Nghề nghiệp
- Kỹ sư Lâm nghiệp
Chương trình cấp giấy của em cũng tương đối đã hoàn thiện nhờ vào Code của anh BaTê viết nay em đã áp dụng được vào chương trình của mình, tuy nhiên có một vấn đề là phần số thập phân ở mục 3. Thửa đất đăng ký quyền sử dụng" có đối tượng là diện tích khi em lấy dữ liệu từ Sheets"DATA" sang Sheets"BIEU_01" thì nó không hiện là dấu "," mà là dấu "." giờ em muốn chuyển nó thành dấu "," thì phải định dạng trong Code VBA như thế nào ạ mong được anh chị trên diện đàn giúp đỡ.
Em cảm ơn anh chị nhiều!
Dưới đây là Code của em đã viết ở Mudun "BIEU"
Em cảm ơn anh chị nhiều!
Dưới đây là Code của em đã viết ở Mudun "BIEU"
Mã:
Public Sub LOC_BIEU1()On Error Resume NextDim sArr(), dArr(1 To 5, 1 To 1), I As Long, Ong As String, NamSinh As String, CMND As String, NgayCap As String, NamSinh2 As String, CMND2 As String, Ong2 As StringDim Ba As String, NgayCap2 As String, NoiCap As String, Diachi As String, Xa As String, Huyen As String, Tinh As String, DK As String, NoiCap2 As String, Ba2 As StringDim K As Long, j As Long, dArr2(1 To 1, 1 To 1), dArr3(1 To 1, 1 To 1), dArr4(1 To 1, 1 To 1), dArr5(1 To 3, 1 To 1), dArr6(1 To 2, 1 To 1), dArr7(1 To 7, 1 To 1)Dim N As Long, SoTrang As Double, Le As Boolean, Ba3 As String, L As Long, a As Long, b As Long, c As LongDim DCT As String, TK As String, KH As String, Thon As String, DienTich As String, SD_Chung As String, Met As StringDim SD_Rieng As String, MDSD As String, D_RSM As String, D_RST As String, D_RSN As String, SD_Khong As String, Tu_TD As StringDim LD_Xa As String, CBDC As String, NgayCap3 As String, NguoiVietDon As String, KyTen As StringWith Sheets("DATA") sArr = .Range(.[A2], .[A65536].End(xlUp)).Resize(, 35).ValueEnd WithWith Sheets("BIEU_01")DK = .[BK3].Value: Ong = .[BY3].Value: NamSinh = .[BY15].Value: NamSinh2 = .[BY21].Value: CMND = .[BY17].Value: Ong2 = .[BY5].Value: CDDC = .[BY39].ValueNgayCap = .[BY25].Value: NgayCap2 = .[BY27].Value: NoiCap = .[BY29].Value: Ba = .[BY9].Value: NoiCap2 = .[BY31].Value: Tu_TD = .[BY28].ValueDiachi = .[BY33].Value: Xa = .[BY37].Value: Huyen = .[BY35].Value: CMND2 = .[BY19].Value: Ba2 = .[BY11].Value: Ba3 = .[BY7].ValueDCT = .[BY2].Value: TK = .[BY4].Value: KH = .[BY6].Value: Thon = .[BY8].Value: DienTich = .[BY10].Value: SD_Chung = .[BY12].Value: Met = .[BY26].ValueSD_Rieng = .[BY14].Value: MDSD = .[BY16].Value: D_RSM = .[BY18].Value: D_RST = .[BY20].Value: D_RSN = .[BY22].Value: SD_Khong = .[BY24].ValueLD_Xa = .[BL10].Value: CBDC = .[BL11].Value: NgayCap3 = .[BY36].Value: NguoiVietDon = .[BY30].Value: KyTen = .[BY32].ValueFor I = 1 To UBound(sArr, 1) If sArr(I, 1) = DK Then 'Dien thong tin CQL1 If sArr(I, 3) = 1 Then dArr(1, 1) = Ong & UCase(sArr(I, 2)) ElseIf sArr(I, 3) = 2 Then dArr(1, 1) = Ong2 & UCase(sArr(I, 2)) ElseIf sArr(I, 3) = "" Then dArr(1, 1) = UCase(sArr(I, 2)) & CDDC & UCase(sArr(I, 19)) Else dArr(1, 1) = vbNullString End If If sArr(I, 22) <> "" And sArr(I, 1) <> "" And sArr(I, 23) <> "" And sArr(I, 24) <> "" Then dArr(2, 1) = NamSinh & sArr(I, 22) & CMND & sArr(I, 1) & NgayCap & sArr(I, 23) & NoiCap & sArr(I, 24): ElseIf sArr(I, 22) = "" And sArr(I, 1) <> "" And sArr(I, 23) <> "" And sArr(I, 24) <> "" Then dArr(2, 1) = NamSinh2 & sArr(I, 22) & CMND & sArr(I, 1) & NgayCap & sArr(I, 23) & NoiCap & sArr(I, 24) ElseIf sArr(I, 22) <> "" And sArr(I, 1) = "" And sArr(I, 23) <> "" And sArr(I, 24) <> "" Then dArr(2, 1) = NamSinh2 & sArr(I, 22) & CMND2 & sArr(I, 1) & NgayCap & sArr(I, 23) & NoiCap & sArr(I, 24) ElseIf sArr(I, 22) <> "" And sArr(I, 1) <> "" And sArr(I, 23) = "" And sArr(I, 24) <> "" Then dArr(2, 1) = NamSinh2 & sArr(I, 22) & CMND2 & sArr(I, 1) & NgayCap2 & sArr(I, 23) & NoiCap & sArr(I, 24) ElseIf sArr(I, 22) <> "" And sArr(I, 1) <> "" And sArr(I, 23) <> "" And sArr(I, 24) = "" Then dArr(2, 1) = NamSinh2 & sArr(I, 22) & CMND2 & sArr(I, 1) & NgayCap2 & sArr(I, 23) & NoiCap2 & sArr(I, 24) Else dArr(2, 1) = vbNullString End If 'Dien thong tin Ten_VC If sArr(I, 26) = 1 And sArr(I, 25) <> "" Then dArr(3, 1) = Ba3 & UCase(sArr(I, 25)) ElseIf sArr(I, 26) = 2 And sArr(I, 25) <> "" Then dArr(3, 1) = Ba & UCase(sArr(I, 25)) Else dArr(3, 1) = vbNullString End If If sArr(I, 25) <> "" And sArr(I, 27) <> "" And sArr(I, 28) <> "" And sArr(I, 29) <> "" And sArr(I, 30) <> "" Then dArr(4, 1) = NamSinh & sArr(I, 27) & CMND & sArr(I, 28) & NgayCap & sArr(I, 29) & NoiCap & sArr(I, 30) ElseIf sArr(I, 25) <> "" And sArr(I, 27) = "" And sArr(I, 28) <> "" And sArr(I, 29) <> "" And sArr(I, 30) <> "" Then dArr(4, 1) = NamSinh2 & sArr(I, 27) & CMND & sArr(I, 28) & NgayCap & sArr(I, 29) & NoiCap & sArr(I, 30) ElseIf sArr(I, 25) <> "" And sArr(I, 27) <> "" And sArr(I, 28) = "" And sArr(I, 29) <> "" And sArr(I, 30) <> "" Then dArr(4, 1) = NamSinh2 & sArr(I, 27) & CMND2 & sArr(I, 28) & NgayCap & sArr(I, 29) & NoiCap & sArr(I, 30) ElseIf sArr(I, 25) <> "" And sArr(I, 27) <> "" And sArr(I, 28) <> "" And sArr(I, 29) = "" And sArr(I, 30) <> "" Then dArr(4, 1) = NamSinh2 & sArr(I, 27) & CMND2 & sArr(I, 28) & NgayCap2 & sArr(I, 29) & NoiCap & sArr(I, 30) ElseIf sArr(I, 25) <> "" And sArr(I, 27) <> "" And sArr(I, 28) <> "" And sArr(I, 29) <> "" And sArr(I, 30) = "" Then dArr(4, 1) = NamSinh2 & sArr(I, 27) & CMND2 & sArr(I, 28) & NgayCap2 & sArr(I, 29) & NoiCap2 & sArr(I, 30) Else dArr(4, 1) = vbNullString End If 'Dien thong tin Dia chi CQL If sArr(I, 2) <> "" And sArr(I, 4) <> "" Then dArr(5, 1) = Diachi & sArr(I, 4) & Xa & sArr(I, 31) & Huyen Else dArr(5, 1) = vbNullString End If Exit For End IfNext IFor N = I To UBound(sArr, 1) If sArr(N, 1) = DK Then If sArr(N, 18) = "RSN" Then dArr2(1, 1) = "x" ElseIf sArr(N, 18) = "RST" Then dArr2(1, 1) = "x" Else dArr2(1, 1) = vbNullString End If End IfNext NFor j = I To UBound(sArr, 1) If sArr(j, 1) = DK Then If sArr(j, 7) <> "" Then dArr3(1, 1) = sArr(j, 7) Else dArr3(1, 1) = vbNullString End If End IfNext jFor K = I To UBound(sArr, 1) If sArr(K, 1) = DK Then If sArr(K, 21) <> "" Then dArr4(1, 1) = sArr(K, 21) Else dArr4(1, 1) = sArr(K, 6) End If End IfNext KFor L = I To UBound(sArr, 1) If sArr(L, 1) = DK Then If sArr(L, 2) <> "" Then dArr5(1, 1) = DCT & TK & sArr(L, 5) & Thon & sArr(L, 9) & Xa & sArr(L, 31) & Huyen Else dArr5(1, 1) = vbNullString End If If sArr(L, 10) <> "" And sArr(L, 3) = 1 Then dArr5(2, 1) = DienTich & sArr(L, 10) & Met & SD_Chung & SD_Khong & Met & SD_Rieng & sArr(L, 10) & Met ElseIf sArr(L, 10) <> "" And sArr(L, 3) = 2 Then dArr5(2, 1) = DienTich & sArr(L, 10) & Met & SD_Chung & SD_Khong & Met & SD_Rieng & sArr(L, 10) & Met ElseIf sArr(L, 10) <> "" And sArr(L, 3) = "" Then dArr5(2, 1) = DienTich & sArr(L, 10) & Met & SD_Chung & sArr(L, 10) & Met & SD_Rieng & SD_Khong & Met Else dArr5(2, 1) = vbNullString End If If sArr(L, 18) <> "" And sArr(L, 18) = "RSM" Then dArr5(3, 1) = MDSD & D_RSM & Tu_TD ElseIf sArr(L, 18) <> "" And sArr(L, 18) = "RST" Then dArr5(3, 1) = MDSD & D_RST & Tu_TD ElseIf sArr(L, 18) <> "" And sArr(L, 18) = "RSN" Then dArr5(3, 1) = MDSD & D_RSN & Tu_TD Else dArr5(3, 1) = vbNullString End If End IfNext LFor a = I To UBound(sArr, 1) If sArr(a, 1) = DK Then If sArr(a, 18) = "RST" And sArr(a, 20) = 1 Then dArr6(1, 1) = "x" Else dArr6(1, 1) = vbNullString End If If sArr(a, 18) = "RST" And sArr(a, 20) = 2 Then dArr6(2, 1) = "x" Else dArr6(2, 1) = vbNullString End If End IfNext aFor b = I To UBound(sArr, 1) If sArr(b, 1) = DK Then If sArr(b, 2) <> "" Then dArr7(1, 1) = sArr(b, 31) & NgayCap3 Else dArr7(1, 1) = vbNullString End If If sArr(b, 2) <> "" Then dArr7(7, 1) = sArr(b, 2) Else dArr7(7, 1) = vbNullString End If dArr7(2, 1) = NguoiVietDon dArr7(3, 1) = KyTen End IfNext bApplication.EnableEvents = False.[C13:BF17].Value = dArr.[AQ19:AR19].Value = dArr2.[L21:AA21].Value = dArr3.[AK21:BF21].Value = dArr4.[E22:BF24].Value = dArr5.[AB40:AC41].Value = dArr6.[AD54:BF60].Value = dArr7Application.EnableEvents = TrueEnd WithEnd
Sub
Mã: