Skip to content

Instantly share code, notes, and snippets.

Function fCount(strPath)
Dim fCnt As Integer
fCnt = ShowFolderList(strPath)
fCount = fCnt
End Function
Sub CntFiles()
Dim strPath As String
strPath = "A:\Asif\Answers\abc"
ShowFolderList (strPath)
Function CountFilesInFolder(strDir As String, Optional strType As String)
Dim file As Variant, i As Integer
If Left(strDir, 1) <> "\" Then strDir = strDir & "\"
file = Dir(strDir & strType)
While (file <> "")
i = i + 1
file = Dir
Wend
CountFilesInFolder = i
End Function
Function IsWorkBookOpen(FileName As String)
Dim ff As Long, ErrNo As Long
On Error Resume Next
ff = FreeFile()
Open FileName For Input Lock Read As #ff
Close ff
ErrNo = Err
On Error GoTo 0
Sub Sample()
Dim Ret
Ret = IsWorkBookOpen("C:\hocexcelonline.xlsx")
If Ret = True Then
MsgBox "File is open"
Else
MsgBox "File is Closed"
End If
Sub MergeSameCell()
Dim Rng As Range, xCell As Range
Dim xRows As Integer
xTitleId = "HocExcel.Online"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
Application.ScreenUpdating = False
Application.DisplayAlerts = False
xRows = WorkRng.Rows.Count
Function lan_cuoi_save_file() As Date
lan_cuoi_save_file = ThisWorkbook.BuiltinDocumentProperties("Last Save Time")
End Function
E4=IFERROR(LARGE(ROW(INDIRECT($B$1&”:”&$B$2))*NOT(COUNTIF($E$3:E3,ROW(INDIRECT($B$1&”:”&$B$2)))),RANDBETWEEN(1,$B$2-$B$1-ROW(A1)+2)),””)
Function NumAndText(ByVal Amount As Double, _
Optional ByVal StrUnit As String = "Dong") As String
Dim CountGroup&, ArrSo, StrSo$, I&, nSkip&, S$, Ub&
Dim Doc(3)
If StrUnit = "Dong" Then StrUnit = ChrW(272) & ChrW(7891) & "ng"
Doc(0) = "T" & ChrW(7927) ' "Ty"
Doc(1) = "Tri" & ChrW(7879) & "u" ' "Trieu"
Doc(2) = "Ngàn" ' "Ngan"
' Ẩn sheets tab
Sub hide()
ActiveWindow.DisplayWorkbookTabs = False
End Sub
' Hiện sheets tab
Sub show()
ActiveWindow.DisplayWorkbookTabs = True
End Sub
// code by: Thanh ND
// Copy as you wish. No attribution required.
var mangso = ['không', 'một', 'hai', 'ba', 'bốn', 'năm', 'sáu', 'bảy', 'tám', 'chín'];
function dochangchuc(so, daydu) {
var chuoi = "";
chuc = Math.floor(so / 10);
donvi = so % 10;
if (chuc > 1) {
chuoi = " " + mangso[chuc] + " mươi";