excel vba number format file size excel vba number format file size

The solution for “excel vba number format file size excel vba number format file size” can be found here. The following code will assist you in solving the problem.

[<1000000]0.00," KB";[<1000000000]0.00,," MB";0.00,,," GB"Select Case objFile.Size
        Case 0 To 1023
            Cells(NextRow, "D").Value = Format(objFile.Size, "0") & "B"
        Case 1024 To 1048575
            Cells(NextRow, "D").Value = Format(objFile.Size / 1024, "0") & "KB"
        Case 1048576 To 1073741823
            Cells(NextRow, "D").Value = Format(objFile.Size / 1048576, "0") & "MB"
        Case 1073741824 To 1.11111111111074E+20
            Cells(NextRow, "D").Value = Format(objFile.Size / 1073741823, "0.00") & "GB"
End Select

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

Similar Posts