Split a cell containing two numerical values into two separate cells in VBA

  • Thread starter Thread starter XTC8911E
  • Start date Start date
X

XTC8911E

Hi Thread

1) How to split (Unmerge) a cell containing two numerical values, for
example 73.28 - 74.28, into two separate cells in VBA ?

2) How to sort & delete a row of any column, for example
columns("B:B"), containing zero values (not a blank) in VBA ?

Thank

From Richie
 
XTC8911E said:
Hi Thread

1) How to split (Unmerge) a cell containing two numerical values, for
example 73.28 - 74.28, into two separate cells in VBA ?
select cells and use Data .... text to columns .... delimited .... enter -
in other delimiter box


2) How to sort & delete a row of any column, for example
columns("B:B"), containing zero values (not a blank) in VBA ?
sorry - you've lost me. What's a row of any column?

Regards

GB
 
Dim rng as range, rng1 as Range, cell as range
set rng = Columns(2).SpecialCels(xlconstants,xlNumbers)
for each cell in rng
if cell.value = 0 then
if rng1 is nothing then
set rng1 = cell
else
set rng1 = union(cell,rng1)
end if
end if
Next
if not rng1 is nothing then
rng1.Entirerow.Delete
End if

if the zeros are produced by formulas, change xlconstants to xlformulas
 
Back
Top