KB/MB/GB memory converter
Change bytes to KB/MB/GB to 2 decimal places
AI
AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Source Code
Public Function convertmeg(HDD As Long) 'Convert to Kb/MB/GB Dim counter, unitcounter As Integer Dim HDDasD As Double 'hdd as double conversion required for decimals Dim unit As String 'bytes, kb, mb, gb unitcounter = 0 HDDasD = HDD 'Loop For counter = 0 To 3 If HDDasD > 1024 Then HDDasD = (HDDasD / 1024) unitcounter = unitcounter + 1 End If Next If unitcounter = 0 Then unit = "Bytes" If unitcounter = 1 Then unit = "KB" If unitcounter = 2 Then unit = "MB" If unitcounter = 3 Then unit = "GB" HDDasD = Format(HDDasD, "#0.00") '2 decimal places convertmeg = HDDasD End Function
Original Comments (3)
Recovered from Wayback Machine