Peet's code should do it.
Just dont declare the varibles as a specific type, and dont declare parameters as being a specific type either ;

VB Code:
  1. Dim KB
  2. Dim MB
  3. Dim GB
  4. Dim TB
  5.  
  6. KB = 1
  7. MB = 2
  8. GB = 3
  9. TB = 4
  10.  
  11. Function BytesTO(lBytes, convertto)
  12.     BytesTO = lBytes / (1024 ^ convertto)
  13. End Function
  14.  
  15. Sub Command1_Click()
  16.     MsgBox BytesTO(2048, KB)
  17. End Sub

That *should* work.