Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 54
Default extracting specific rows

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
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default extracting specific rows

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

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 54
Default extracting specific rows

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

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default extracting specific rows

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

  #5   Report Post  
Posted to microsoft.public.excel.misc
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



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default extracting specific rows

Hi,

When you've pasted it into a module you need to change the sheet names

Sheet1 gets changed to the sheet you want to copy from
Sheet2 gets changed to the sheet you want to paste to
Both sheet names must be in quotes as they are now.

When you've done that tap F5

Mike

"wynand" wrote:

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

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 54
Default extracting specific rows

Mike

I'm still not coming right, the sheet names are named as normal (1,2,3)
F5 takes me to a go to dialogue box with no results

"Mike H" wrote:

Hi,

When you've pasted it into a module you need to change the sheet names

Sheet1 gets changed to the sheet you want to copy from
Sheet2 gets changed to the sheet you want to paste to
Both sheet names must be in quotes as they are now.

When you've done that tap F5

Mike

"wynand" wrote:

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

  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default extracting specific rows

Iy sounds like your on the worksheet hen tapping F5

You tap F5 while in VB editor with the cursor within the subroutine or you
can run it from the worksheet by clicking

Tools|Macro|Macros
Select the name of the macro and click run

Mike

"wynand" wrote:

Mike

I'm still not coming right, the sheet names are named as normal (1,2,3)
F5 takes me to a go to dialogue box with no results

"Mike H" wrote:

Hi,

When you've pasted it into a module you need to change the sheet names

Sheet1 gets changed to the sheet you want to copy from
Sheet2 gets changed to the sheet you want to paste to
Both sheet names must be in quotes as they are now.

When you've done that tap F5

Mike

"wynand" wrote:

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

  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 54
Default extracting specific rows

Brilliant Mike, initially gave me "syntax error" after F5, but I pasted into
a new sheet and now it works.

Thank you

"Mike H" wrote:

Iy sounds like your on the worksheet hen tapping F5

You tap F5 while in VB editor with the cursor within the subroutine or you
can run it from the worksheet by clicking

Tools|Macro|Macros
Select the name of the macro and click run

Mike

"wynand" wrote:

Mike

I'm still not coming right, the sheet names are named as normal (1,2,3)
F5 takes me to a go to dialogue box with no results

"Mike H" wrote:

Hi,

When you've pasted it into a module you need to change the sheet names

Sheet1 gets changed to the sheet you want to copy from
Sheet2 gets changed to the sheet you want to paste to
Both sheet names must be in quotes as they are now.

When you've done that tap F5

Mike

"wynand" wrote:

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

  #10   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default extracting specific rows

We got there in the end, thanks for the feedback

"wynand" wrote:

Brilliant Mike, initially gave me "syntax error" after F5, but I pasted into
a new sheet and now it works.

Thank you

"Mike H" wrote:

Iy sounds like your on the worksheet hen tapping F5

You tap F5 while in VB editor with the cursor within the subroutine or you
can run it from the worksheet by clicking

Tools|Macro|Macros
Select the name of the macro and click run

Mike

"wynand" wrote:

Mike

I'm still not coming right, the sheet names are named as normal (1,2,3)
F5 takes me to a go to dialogue box with no results

"Mike H" wrote:

Hi,

When you've pasted it into a module you need to change the sheet names

Sheet1 gets changed to the sheet you want to copy from
Sheet2 gets changed to the sheet you want to paste to
Both sheet names must be in quotes as they are now.

When you've done that tap F5

Mike

"wynand" wrote:

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

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
Extracting characters before or after a specific character Brian Excel Worksheet Functions 4 April 27th 23 07:42 PM
extracting specific rows wynand Excel Discussion (Misc queries) 6 January 29th 08 01:15 PM
Extracting specific word in a cell Conditional Formatting Excel Worksheet Functions 2 February 14th 06 09:57 PM
Extracting specific data from a cell Neil Bowen Excel Worksheet Functions 5 October 30th 05 04:33 PM
Pivot Table - Extracting specific data JT Excel Worksheet Functions 1 June 3rd 05 06:05 PM


All times are GMT +1. The time now is 08:05 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"