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

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
 
G

GB

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
 
T

Tom Ogilvy

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top