A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Find



 
 
Thread Tools Display Modes
  #1  
Old May 27th, 2010, 09:17 PM posted to microsoft.public.excel.misc
Randy
external usenet poster
 
Posts: 398
Default Find

I have numbers in column A that don't belong such as;
74-350-77-50
18-350-077-51
36-100-001-03

the 3rd digit should not be a "-"
the rest of them would read
74350-77-50
18350-077-51
36100-001-03

What I need to do is find them and delete that row

Any ideas?
--
Randy
  #2  
Old May 27th, 2010, 09:47 PM posted to microsoft.public.excel.misc
Randy
external usenet poster
 
Posts: 398
Default Find

Thank you so much, you're a life saver
--
Randy


"Jacob Skaria" wrote:

You can try out the below macro. If you are new to macros..

--Set the Security level to low/medium in (Tools|Macro|Security).
--From workbook launch VBE using short-key Alt+F11.
--From menu 'Insert' a module and paste the below code.
--Get back to Workbook.
--Run macro from Tools|Macro|Run selected macro()

Sub DeleteRows()
Dim lngRow As Long
For lngRow = Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -1
If Mid(Range("A" & lngRow).Text, 3, 1) = "-" Then Rows(lngRow).Delete
Next
End Sub


PS: If you dont prefer a VBA solution in cell B1 enter the formula
=MID(A1,3,1)="-" and copy down as required. Sort ColB and delete rows with
TRUE

--
Jacob (MVP - Excel)


"Randy" wrote:

Thanks for getting back so soon, however I don't want to replace the dash, I
want to delete any rows where the 3rd character = "-"
--
Randy


"Jacob Skaria" wrote:

Try SUBSTITUTE() with the text in cell A1

=SUBSTITUTE(A1,"-",,1)

--
Jacob (MVP - Excel)


"Randy" wrote:

I have numbers in column A that don't belong such as;
74-350-77-50
18-350-077-51
36-100-001-03

the 3rd digit should not be a "-"
the rest of them would read
74350-77-50
18350-077-51
36100-001-03

What I need to do is find them and delete that row

Any ideas?
--
Randy

  #3  
Old May 27th, 2010, 10:14 PM posted to microsoft.public.excel.misc
Jacob Skaria
external usenet poster
 
Posts: 5,952
Default Find

Try SUBSTITUTE() with the text in cell A1

=SUBSTITUTE(A1,"-",,1)

--
Jacob (MVP - Excel)


"Randy" wrote:

I have numbers in column A that don't belong such as;
74-350-77-50
18-350-077-51
36-100-001-03

the 3rd digit should not be a "-"
the rest of them would read
74350-77-50
18350-077-51
36100-001-03

What I need to do is find them and delete that row

Any ideas?
--
Randy

  #4  
Old May 27th, 2010, 10:38 PM posted to microsoft.public.excel.misc
Jacob Skaria
external usenet poster
 
Posts: 5,952
Default Find

You can try out the below macro. If you are new to macros..

--Set the Security level to low/medium in (Tools|Macro|Security).
--From workbook launch VBE using short-key Alt+F11.
--From menu 'Insert' a module and paste the below code.
--Get back to Workbook.
--Run macro from Tools|Macro|Run selected macro()

Sub DeleteRows()
Dim lngRow As Long
For lngRow = Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -1
If Mid(Range("A" & lngRow).Text, 3, 1) = "-" Then Rows(lngRow).Delete
Next
End Sub


PS: If you dont prefer a VBA solution in cell B1 enter the formula
=MID(A1,3,1)="-" and copy down as required. Sort ColB and delete rows with
TRUE

--
Jacob (MVP - Excel)


"Randy" wrote:

Thanks for getting back so soon, however I don't want to replace the dash, I
want to delete any rows where the 3rd character = "-"
--
Randy


"Jacob Skaria" wrote:

Try SUBSTITUTE() with the text in cell A1

=SUBSTITUTE(A1,"-",,1)

--
Jacob (MVP - Excel)


"Randy" wrote:

I have numbers in column A that don't belong such as;
74-350-77-50
18-350-077-51
36-100-001-03

the 3rd digit should not be a "-"
the rest of them would read
74350-77-50
18350-077-51
36100-001-03

What I need to do is find them and delete that row

Any ideas?
--
Randy

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:36 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.