Skip to content

Instantly share code, notes, and snippets.

Thiết lập:
A1=2020
AN1="SUN" hoặc "MON"
Tác giả: T.D.Nguyen
Rút gọn: N.D.Thanh
=ArrayFormula({
{"\/";TEXT(DATE(A1,ROW(1:12),1),"mmmm")}
,{
UPPER(TEXT("1/1/2018"+COLUMN($A$1:$AP$1)-(1+(AN1=TEXT(DATE(2017,1,1),"ddd"))),"DDD"));
Option Explicit
Private Const PAGE_EXECUTE_READWRITE = &H40
Private Declare Sub MoveMemory Lib "kernel32" Alias "RtlMoveMemory" _
(Destination As Long, Source As Long, ByVal Length As Long)
Private Declare Function VirtualProtect Lib "kernel32" (lpAddress As Long, _
ByVal dwSize As Long, ByVal flNewProtect As Long, lpflOldProtect As Long) As Long
Function bo_dau_tieng_viet(Text As String) As String
Dim AsciiDict As Object
Set AsciiDict = CreateObject("scripting.dictionary")
AsciiDict(192) = "A"
AsciiDict(193) = "A"
AsciiDict(194) = "A"
AsciiDict(195) = "A"
AsciiDict(196) = "A"
AsciiDict(197) = "A"
AsciiDict(199) = "C"
Function UniConvert(Text As String, InputMethod As String) As String
Dim VNI_Type, Telex_Type, CharCode, Temp, i As Long
UniConvert = Text
VNI_Type = Array("a81", "a82", "a83", "a84", "a85", "a61", "a62", "a63", "a64", "a65", "e61", _
"e62", "e63", "e64", "e65", "o61", "o62", "o63", "o64", "o65", "o71", "o72", "o73", "o74", _
"o75", "u71", "u72", "u73", "u74", "u75", "a1", "a2", "a3", "a4", "a5", "a8", "a6", "d9", _
"e1", "e2", "e3", "e4", "e5", "e6", "i1", "i2", "i3", "i4", "i5", "o1", "o2", "o3", "o4", _
"o5", "o6", "o7", "u1", "u2", "u3", "u4", "u5", "u7", "y1", "y2", "y3", "y4", "y5")
Telex_Type = Array("aws", "awf", "awr", "awx", "awj", "aas", "aaf", "aar", "aax", "aaj", "ees", _
"eef", "eer", "eex", "eej", "oos", "oof", "oor", "oox", "ooj", "ows", "owf", "owr", "owx", _
Sub PasswordBreaker()
'Breaks worksheet password protection.
Dim i As Integer, j As Integer, k As Integer
Dim l As Integer, m As Integer, n As Integer
Dim i1 As Integer, i2 As Integer, i3 As Integer
Dim i4 As Integer, i5 As Integer, i6 As Integer
On Error Resume Next
For i = 65 To 66: For j = 65 To 66: For k = 65 To 66
For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66
For i2 = 65 To 66: For i3 = 65 To 66: For i4 = 65 To 66
Option Explicit
Private Const PAGE_EXECUTE_READWRITE = &H40
Private Declare PtrSafe Sub MoveMemory Lib "kernel32" Alias "RtlMoveMemory" _
(Destination As LongPtr, Source As LongPtr, ByVal Length As LongPtr)
Private Declare PtrSafe Function VirtualProtect Lib "kernel32" (lpAddress As LongPtr, _
ByVal dwSize As LongPtr, ByVal flNewProtect As LongPtr, lpflOldProtect As LongPtr) As LongPtr
@ndthanh
ndthanh / gadm36_VNM_0.json
Created September 7, 2021 16:52 — forked from tandat2209/gadm36_VNM_0.json
Vietnam with Paracel Island and Spartly Island Topojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ndthanh
ndthanh / gist:015198bd57d2fa278fb0df033d72b844
Created August 26, 2021 17:38 — forked from spiridenok/gist:6154707
VBA: replace last occurrence of a string within a string
' replace only the LAST occurrence of a the SEARCH substring in SOURCE
' with the REPLACESTR string - search isn't case-sensitive
ReplaceLast = StrReverse(Replace(StrReverse(Source), StrReverse(Search), StrReverse(ReplaceStr), , 1))
Source: https://blog.hocexcel.online/doc-thanh-chu-bang-ham-trong-excel-bao-gom-tieng-anh-tieng-viet.html?hocexcelonline
copy only formula below and enter number in cell A2
=TRIM(IF(OR(LEN(FLOOR(A2,1))=13,FLOOR(A2,1)<=0),"Out of range",PROPER(SUBSTITUTE(CONCATENATE(
CHOOSE(MID(TEXT(INT(A2),REPT(0,12)),1,1)+1,"","one hundred ","two hundred ","three hundred ","four hundred ","five hundred ","six hundred ","seven hundred ","eight hundred ","nine hundred "),
CHOOSE(MID(TEXT(INT(A2),REPT(0,12)),2,1)+1,"",
CHOOSE(MID(TEXT(INT(A2),REPT(0,12)),3,1)+1,"ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"),"twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"),IF(VALUE(MID(TEXT(INT(A2),REPT(0,12)),2,1))>1,
CHOOSE(MID(TEXT(INT(A2),REPT(0,12)),3,1)+1,"","-one","-two","-three","-four","-five","-six","-seven","-eight","-nine"),IF(VALUE(MID(TEXT(INT(A2),REPT(0,12)),2,1))=0,
CHOOSE(MID(TEXT(INT(A2),REPT(0,12)),3,1)+1,"","one","two","three","four","five","six","se
@ndthanh
ndthanh / excelwebservice.vb
Created June 17, 2021 15:43 — forked from seamusabshere/excelwebservice.vb
Excel VB for accessing http://carbon.brighterplanet.com/flights.txt as a web service (early 2011)
Option Explicit
Function GetBrighterPlanetApiKey()
GetBrighterPlanetApiKey = ActiveWorkbook.Worksheets("Setup").Range("C2").Value
End Function
Function IsEmissionEstimateServiceOnline()
If LCase(ActiveWorkbook.Worksheets("Setup").Range("C3").Value) = "online" And ThisWorkbook.HasFinishedWorkbookOpen() = True Then
IsEmissionEstimateServiceOnline = True
Else