I am just starting to learn about using arrays in VBA to improve efficiency when performing various functions across large data sets. I have an array defined as follows:
Dim MyArray as Variant
MyArray = Range("BS27:DS50000")
The values in this range will either contain text or a value of zero. I want to replace all zeroes with a blank/null value. How do I write the code that does this? I have recorded the search & replace code but I believe the syntax would be different when using an array vs. actually selecting the range from the worksheet. Just FYI, here is the recorded code (minus apostrophes, of course):
' Range("BS27:DS50000").Replace What:="0", Replacement:="", LookAt:=xlWhole, _
' SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
' ReplaceFormat:=False
' Range("BS27").Select
Dim MyArray as Variant
MyArray = Range("BS27:DS50000")
The values in this range will either contain text or a value of zero. I want to replace all zeroes with a blank/null value. How do I write the code that does this? I have recorded the search & replace code but I believe the syntax would be different when using an array vs. actually selecting the range from the worksheet. Just FYI, here is the recorded code (minus apostrophes, of course):
' Range("BS27:DS50000").Replace What:="0", Replacement:="", LookAt:=xlWhole, _
' SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
' ReplaceFormat:=False
' Range("BS27").Select