I got this code that divides a range of values (the values have a number format like 9.12) by 100.
Before dividing, I format the range by applying a percentage format so the value becomes 912%
and after dividing it becomes 9.12%
The range also has blank cells (and zero values), which after dividing they take a value of 0%.
So I need to clear all the values that are zeros, and for this, I tried this code, but got an error "Type mismatch".
Dim ColSelRange as Range
Dim DivCell as string
Set ColSelRange = Range("B2","B100").Select
DivCell = "A1"
Range(DivCell) = 100
Range(DiCell).Copy
ColSelRange.Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlDivide, _
SkipBlanks:=False, Transpose:=False
If Selection.Value2 = "0%" Then
Selection.ClearContents
End If
Is there any way to bypass this error? or does exist other different solutions (without using for loops)?