View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
wynand wynand is offline
external usenet poster
 
Posts: 54
Default extracting specific rows

Can you please explain steps after module has been pasted
I seem to be doing something wrong

"Mike H" wrote:

Alt+F11 to open editor, right click 'This Workbook' insert module and paste
this in.

Sub stance()
Dim myrange, copyrange As Range
Sheets("Sheet1").Select 'Change to suit
LastRow = Cells(Cells.Rows.Count, "C").End(xlUp).Row
Set myrange = Range("C1:C" & LastRow)
For Each C In myrange
With Application.WorksheetFunction
numnames = Len(.Trim(C.Text)) - Len(.Substitute(.Trim(C), " ", "")) + 1
End With
If numnames = 1 Then
If copyrange Is Nothing Then
Set copyrange = C.EntireRow
Else
Set copyrange = Union(copyrange, C.EntireRow)
End If
End If
Next
copyrange.Copy
Sheets("Sheet2").Select 'Change to suit
Cells(1, 1).Select
ActiveSheet.Paste
End Sub

Mike

"wynand" wrote:

the sheet is copied from selected sent emails in lotus notes
I want to divide internal sent emails from external sent emails.
Lotus is set up so that in Column C (Header named 'Who') Internal emails
shows names and surnames. External emails show only names.
I want to ectract rows with only one name in Column C

"Mike H" wrote:

I would like to extract rows to
another sheet where cells in column C do either have only one name or more
than one name.

That means eveything, what is it you want to extract?

Mike


"wynand" wrote:

Looking for help with the following:

Numeric and non numeric data is in A2:F1580, A1:F1 is the header row.
Column C has different names and surnames in one cell, separated by a space.
Some cells have only names, some cells have names, middlenames and surnames
and some have only names and surnames. I would like to extract rows to
another sheet where cells in column C do either have only one name or more
than one name.
Any ideas in terms of a macro or function?

Regards