This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Sub Sample() | |
| Dim Ret | |
| Ret = IsWorkBookOpen("C:\hocexcelonline.xlsx") | |
| If Ret = True Then | |
| MsgBox "File is open" | |
| Else | |
| MsgBox "File is Closed" | |
| End If |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Function lan_cuoi_save_file() As Date | |
| lan_cuoi_save_file = ThisWorkbook.BuiltinDocumentProperties("Last Save Time") | |
| End Function |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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)),””) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ' Ẩn sheets tab | |
| Sub hide() | |
| ActiveWindow.DisplayWorkbookTabs = False | |
| End Sub | |
| ' Hiện sheets tab | |
| Sub show() | |
| ActiveWindow.DisplayWorkbookTabs = True | |
| End Sub |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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"; |