Professional Documents
Culture Documents
Tổng Hợp Vba 1. Chạy macro trong sheet bị protect (2 cách)
Tổng Hợp Vba 1. Chạy macro trong sheet bị protect (2 cách)
Tổng Hợp Vba 1. Chạy macro trong sheet bị protect (2 cách)
Chèn Header/Footer vào tất cả các sheet (thay đổi Center/Left/Right để canh)
Sub AddHeaderToAll()
'Update 20140318
Dim WorkRng As Range
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection.Range("A1")
Set WorkRng = Application.InputBox("Range (single cell)", xTitleId, WorkRng.Address, Type:=8)
For Each ws In Application.ActiveWorkbook.Worksheets
ws.PageSetup.LeftHeader = WorkRng.Range("A1").Value
Next
End Sub
3. Tự động đọc số tiền bằng chữ từ một Cell
Function UnicodeChar(UniCharCode As String) As String
On Error GoTo Loi
Dim str
Dim desStr As String
Dim I
If Mid(UniCharCode, 1, 1) = ";" Then
UniCharCode = Mid(UniCharCode, 2)
End If
If Right(UniCharCode, 1) = ";" Then
UniCharCode = Mid(UniCharCode, 1, Len(UniCharCode) - 1)
End If
str = UniCharCode
str = Split(str, ";")
For I = LBound(str) To UBound(str)
desStr = desStr & ChrW$("&H" & str(I))
Next
UnicodeChar = desStr
Loi:
Exit Function
End Function