Kullanıcı
- Katılım
- 15 Tem 2019
- Mesajlar
- 88
- Excel Versiyonu
- Excel 2016
- Excel Sürümü
- 64 Bit
- Excel Dili
- Türkçe
İyi Akşamlar.
Aşağıya yazdığım kod ile örnek tablo ile bu vba tablosu olur mu? Eğer olursa yapabilir misiniz?
Örnek excel tablosunu ekledim.
Sub ConvertByteTags()
' This code will navigate down column B, starting at row 2
' and replace every GB, KB and MB value with its equivalent extended value
Dim iRow As Integer
Dim strValue As String
Dim strSizeType As String
Dim dblNewValue As Double
Const ConversionFactor As Integer = 1024 ' 1024
iRow = 2
Do
strValue = Cells(iRow, 2).Value
If strValue = "" Then
Exit Do
End If
strSizeType = Right(strValue, 2)
Select Case strSizeType
Case "TB" ' terrabytes
dblNewValue = Val(strValue) * ConversionFactor
Case "GB" ' gigabytes
dblNewValue = Val(strValue) * 1
Case "MB" ' megabytes
dblNewValue = Val(strValue) / ConversionFactor
Case "KB" ' kilobytes
dblNewValue = Val(strValue) / ConversionFactor / ConversionFactor
Case Else
dblNewValue = Val(strValue) / ConversionFactor / ConversionFactor / ConversionFactor
End Select
Cells(iRow, 3).Value = dblNewValue
iRow = iRow + 1
Loop
MsgBox "Cells converted into GB", vbOKOnly Or vbInformation
End Sub
Aşağıya yazdığım kod ile örnek tablo ile bu vba tablosu olur mu? Eğer olursa yapabilir misiniz?
Örnek excel tablosunu ekledim.
Sub ConvertByteTags()
' This code will navigate down column B, starting at row 2
' and replace every GB, KB and MB value with its equivalent extended value
Dim iRow As Integer
Dim strValue As String
Dim strSizeType As String
Dim dblNewValue As Double
Const ConversionFactor As Integer = 1024 ' 1024
iRow = 2
Do
strValue = Cells(iRow, 2).Value
If strValue = "" Then
Exit Do
End If
strSizeType = Right(strValue, 2)
Select Case strSizeType
Case "TB" ' terrabytes
dblNewValue = Val(strValue) * ConversionFactor
Case "GB" ' gigabytes
dblNewValue = Val(strValue) * 1
Case "MB" ' megabytes
dblNewValue = Val(strValue) / ConversionFactor
Case "KB" ' kilobytes
dblNewValue = Val(strValue) / ConversionFactor / ConversionFactor
Case Else
dblNewValue = Val(strValue) / ConversionFactor / ConversionFactor / ConversionFactor
End Select
Cells(iRow, 3).Value = dblNewValue
iRow = iRow + 1
Loop
MsgBox "Cells converted into GB", vbOKOnly Or vbInformation
End Sub
CEVAP BIRAK
E-posta adresiniz yayınlanmaz. Gerekli alanlar işaretlenir *Ekli dosyalar