MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Null-Type command


Posted by Jason on January 18, 2002 11:38 AM

I am making a macro, that when used, strikes out the numbers in the cell. The numbers are part of a total, and when i put a strikeout thru them, i would like the number to be rendered moot. I stil want the number there, but i would like it to have no value, have a value of zero.this is it-
With Selection.Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = True
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
End Sub


Posted by Jerid on January 18, 2002 12:16 PM

You could change it into text by placing a ' in front of the number

Sub test()
Dim vTempHolder As Variant

With Selection.Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = True
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With

vTempHolder = ActiveCell.Value
ActiveCell.Value = "'" & vTempHolder

End Sub