Em muốn nhờ Thầy chỉ giúp code gán A1:CC1 giá trị tuần tự của chuỗi cho trước?
Em có một dãy mặc định cho trước như sau:
arr = Array("brcd", "custseq", "custnm", "apprseq", "apprdt", "apprmatdt", _ "ccy", "appramt", "dsbsseq", "dsbsdt", "dsbsmatdt", "sprd", "sprdpst", "dsbsamt", _ "dsbsccy", "rpmtamt", "intamt", "dsbsbal", "dsbsamt2", "rpmtamt2", "intamt2", "subunit", _ "custstscd", "custtpcd", "custtpnm", "custdtltpcd", "custdtltpnm", "ecomist", "ecomistnm", _ "taxtpcdloc", "taxtpcdlocnm", "ofcno", "ofcnm", "pstintamt", "pstintamt2", "buscd", "lntpcd", _ "lnsbtpcd", "lstrpmtdt", "lstintchrgprd", "nxtrpmtschddt", "nxtintschddt", "exmtintamt", "exmtintamt2", _ "finainsttpcd", "finainsttpcdnm", "sicdloc", "province", "provincenm", "district", "districtnm", "zipcd", _ "addr1", "secured", "fndrstpcd", "fndrsnm", "exemptint", "exemptinttype", "fndprpstpcd", "fndprpstpcd_code", _ "intrpmtamt", "AQCCDFIN", "intrpmtamt2", "commcd", "commmn", "grpno", "trctcd", "trctnm", "BSNSSCLTPCD", "usrid", _ "usrnm", "acramt", "lceqa", "yrdays", "intcmth", "intrpymth", "inttrmmth", "remark", "chitiet_htls", "ctcv", _ "credittype")Em muốn hỏi code làm thế nào để gán giá trị thứ 1 vào A1, giá trị thứ 2 vào B1, giá trị thứ 3 vào C1,… giá trị thứ 81 vào CC1 ah?
Em mày mò mãi mà chưa ra ah, mong các Thầy chỉ giúp ah!
Public Sub ThayGomQuaDi()
Dim Arr, I As Long
Arr = Array("brcd", "custseq", "custnm", "apprseq", "apprdt", "apprmatdt", _
"ccy", "appramt", "dsbsseq", "dsbsdt", "dsbsmatdt", "sprd", "sprdpst", "dsbsamt", _
"dsbsccy", "rpmtamt", "intamt", "dsbsbal", "dsbsamt2", "rpmtamt2", "intamt2", "subunit", _
"custstscd", "custtpcd", "custtpnm", "custdtltpcd", "custdtltpnm", "ecomist", "ecomistnm", _
"taxtpcdloc", "taxtpcdlocnm", "ofcno", "ofcnm", "pstintamt", "pstintamt2", "buscd", "lntpcd", _
"lnsbtpcd", "lstrpmtdt", "lstintchrgprd", "nxtrpmtschddt", "nxtintschddt", "exmtintamt", "exmtintamt2", _
"finainsttpcd", "finainsttpcdnm", "sicdloc", "province", "provincenm", "district", "districtnm", "zipcd", _
"addr1", "secured", "fndrstpcd", "fndrsnm", "exemptint", "exemptinttype", "fndprpstpcd", "fndprpstpcd_code", _
"intrpmtamt", "AQCCDFIN", "intrpmtamt2", "commcd", "commmn", "grpno", "trctcd", "trctnm", "BSNSSCLTPCD", "usrid", _
"usrnm", "acramt", "lceqa", "yrdays", "intcmth", "intrpymth", "inttrmmth", "remark", "chitiet_htls", "ctcv", _
"credittype")
For I = 0 To UBound(Arr)
Range("A1").Offset(, I).Value = Arr(I)
Next I
End Sub
www.giaiphapexcel.com/diendan/threads/em-mu%E1%BB%91n-nh%E1%BB%9D-th%E1%BA%A7y-ch%E1%BB%89-gi%C3%BAp-code-g%C3%A1n-a1-cc1-gi%C3%A1-tr%E1%BB%8B-tu%E1%BA%A7n-t%E1%BB%B1-c%E1%BB%A7a-chu%E1%BB%97i-cho-tr%C6%B0%E1%BB%9Bc.112549/
Khóa học SprinGO phù hợp
Học Nhân sự Tổng hợp – Trở thành chiến binh nhân sự vững nghiệp vụ
Con người là một trong những yếu tố quan trọng của công ty, là tài sản quý giá của doanh nghiệp. Chính vì thế,...
Xem khóa học
Bình luận