hello
I'm looking for a vba to delete the rest of row if found more that two spaces
example
UV4003K 0.01% 31750 kg/hr 3,175 kg/hr 52.91666667 --> UV4003K 0.01% 31750 kg/hr 3,175 kg/hr
the same for all rows
is it possible ?
thank you
ccruz
hello
I'm looking for a vba to delete the rest of row if found more that two spaces
example
UV4003K 0.01% 31750 kg/hr 3,175 kg/hr 52.91666667 --> UV4003K 0.01% 31750 kg/hr 3,175 kg/hr
the same for all rows
is it possible ?
thank you
ccruz
If you mean find 2 consecutive spaces, then this would do it
intRowCount = 1
Do until range("A" & intRowCount).value =""
intTwoSpace = instr(1,range("A" & intRowCount).value,string(2,32))
if intTwoSpace >0 then
range("A" & intRowCount).value = trim(mid(range("A" & intRowCount).value,1,intTwoSpace))
end if
intRowCOunt=intRowCOunt+1
loop
If you wanted to delete everything after the 2nd non consecutive space, try
intRowCount = 1
Do until range("A" & intRowCount).value =""
intTwoSpaceFI = instr(1,range("A" & intRowCount).value,chr(32))
intTwoSpaceSI = instr(intTwoSpaceFI ,range("A" & intRowCount).value,chr(32))
if intTwoSpaceSI >0 then
range("A" & intRowCount).value = trim(mid(range("A" & intRowCount).value,1,intTwoSpaceSI))
end if
intRowCOunt=intRowCOunt+1
loop
I wrote these in notepad, not in VBA, so may need a bit of tweaking.
the first is perfect thank you
is it possible find and delete large numbers .
example in a spreadsheet find and delete numbers graeter than 10000 ?
Very similar
http://www.excelforum.com/excel-prog...wo-spaces.html
Please Login or Register to view this content.
sorry. my question was find and delete numbers with more than 5 characters AFTER two spaces
thank you
ccruz
Please Login or Register to view this content.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks