Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default Need to remove cells with variable data

Hi All!
I have a worksheet containing a column for phone numbers. However,
some of the numbers are missing area codes and are listed in 7 digit
format(1234567) How do I remove the rows that contain the cells in the
phone number column that only contain 7 numeric characters. And
sometimes the imported file will have dashes or paranthesis. I can
remove blank rows, or just blank cells, or cells with specific
characters, but how do you remove the data when each digit can be
different? I was hoping the good ol' "*" key would work, but it only
took out cells that actually contain the "*" character. The only
constant is the number of characters, 7. And be gentle, this is only
my third day working with macros.

thanks!
Cheney

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default Need to remove cells with variable data

Assuming your 7 digit numbers are true numbers, enter in a helper column:

=(LEN(A1)=7)*(ISNUMBER(A1))

and copy down. Switch on autofilter and remove rows with value 1
--
Gary''s Student - gsnu200731


" wrote:

Hi All!
I have a worksheet containing a column for phone numbers. However,
some of the numbers are missing area codes and are listed in 7 digit
format(1234567) How do I remove the rows that contain the cells in the
phone number column that only contain 7 numeric characters. And
sometimes the imported file will have dashes or paranthesis. I can
remove blank rows, or just blank cells, or cells with specific
characters, but how do you remove the data when each digit can be
different? I was hoping the good ol' "*" key would work, but it only
took out cells that actually contain the "*" character. The only
constant is the number of characters, 7. And be gentle, this is only
my third day working with macros.

thanks!
Cheney


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,441
Default Need to remove cells with variable data

Cheney,

Select a cell in the column with the numbers, and run the macro below. This assumes that your data
is contiguous....

HTH,
Bernie
MS Excel MVP

Sub CheneyDelete7()
Dim myR As Range
Set myR = Intersect(ActiveCell.EntireColumn, ActiveCell.CurrentRegion)
myR.Offset(0, 1).EntireColumn.Insert
myR(1, 2).Value = "Length"
myR(2, 2).Resize(myR.Rows.Count - 1, 1).FormulaR1C1 = "=LEN(RC[-1])"
myR.Offset(0, 1).AutoFilter Field:=1, Criteria1:="7"
myR.Offset(1, 1).Resize(myR.Rows.Count - 1, 1). _
SpecialCells(xlCellTypeVisible).EntireRow.Delete
myR.Offset(0, 1).EntireColumn.Delete
End Sub




wrote in message ups.com...
Hi All!
I have a worksheet containing a column for phone numbers. However,
some of the numbers are missing area codes and are listed in 7 digit
format(1234567) How do I remove the rows that contain the cells in the
phone number column that only contain 7 numeric characters. And
sometimes the imported file will have dashes or paranthesis. I can
remove blank rows, or just blank cells, or cells with specific
characters, but how do you remove the data when each digit can be
different? I was hoping the good ol' "*" key would work, but it only
took out cells that actually contain the "*" character. The only
constant is the number of characters, 7. And be gentle, this is only
my third day working with macros.

thanks!
Cheney



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default Need to remove cells with variable data

On Jun 20, 2:34 pm, "Bernie Deitrick" <deitbe @ consumer dot org
wrote:
Cheney,

Select a cell in the column with the numbers, and run the macro below. This assumes that your data
is contiguous....

HTH,
Bernie
MS Excel MVP

Sub CheneyDelete7()
Dim myR As Range
Set myR = Intersect(ActiveCell.EntireColumn, ActiveCell.CurrentRegion)
myR.Offset(0, 1).EntireColumn.Insert
myR(1, 2).Value = "Length"
myR(2, 2).Resize(myR.Rows.Count - 1, 1).FormulaR1C1 = "=LEN(RC[-1])"
myR.Offset(0, 1).AutoFilter Field:=1, Criteria1:="7"
myR.Offset(1, 1).Resize(myR.Rows.Count - 1, 1). _
SpecialCells(xlCellTypeVisible).EntireRow.Delete
myR.Offset(0, 1).EntireColumn.Delete
End Sub



wrote in oglegroups.com...
Hi All!
I have a worksheet containing a column for phone numbers. However,
some of the numbers are missing area codes and are listed in 7 digit
format(1234567) How do I remove the rows that contain the cells in the
phone number column that only contain 7 numeric characters. And
sometimes the imported file will have dashes or paranthesis. I can
remove blank rows, or just blank cells, or cells with specific
characters, but how do you remove the data when each digit can be
different? I was hoping the good ol' "*" key would work, but it only
took out cells that actually contain the "*" character. The only
constant is the number of characters, 7. And be gentle, this is only
my third day working with macros.


thanks!
Cheney- Hide quoted text -


- Show quoted text -


You guys Rock! I entered in your entire macro and it worked like a
charm! thank you soooooo much!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading data from another sheet where data is in variable cells JDB Excel Discussion (Misc queries) 4 January 2nd 07 11:04 AM
Lookup variable data on a spreadsheet, and remove duplicates from another Robertson Excel Worksheet Functions 0 December 1st 06 03:55 PM
Sum cells based on a row variable and seperate column variable CheeseHeadTransplant Excel Worksheet Functions 10 September 23rd 05 06:59 PM
Remove variable text in cells BHalberstater Excel Worksheet Functions 3 August 16th 05 04:37 AM
Lookup with two variable data list cells Monkey Excel Worksheet Functions 2 February 10th 05 11:29 PM


All times are GMT +1. The time now is 09:34 AM.

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

About Us

"It's about Microsoft Excel"