Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 does either have only one name or more than one name. Any ideas in terms of a macro or function? Regards |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
extracting specific rows
Sub extractsinglenames()
NewRowCount = 2 With ActiveSheet LastRow = .Range("C" & Rows.Count).End(xlUp).Row 'copy header row .Row(1).Copy Destination:=Sheets("Sheet2").Rows(1) For RowCount = 2 To LastRow If InStr(.Range("C" & RowCount), " ") = 0 Then .Row(RowCount).Copy _ Destination:=Sheets("Sheet2").Rows(NewRowCount) NewRowCount = NewRowCount + 1 End If Next RowCount End With End Sub Sub extractmultinames() NewRowCount = 2 With ActiveSheet LastRow = .Range("C" & Rows.Count).End(xlUp).Row 'copy header row .Row(1).Copy Destination:=Sheets("Sheet2").Rows(1) For RowCount = 2 To LastRow If InStr(.Range("C" & RowCount), " ") 0 Then .Row(RowCount).Copy _ Destination:=Sheets("Sheet2").Rows(NewRowCount) NewRowCount = NewRowCount + 1 End If Next RowCount End With "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 does either have only one name or more than one name. Any ideas in terms of a macro or function? Regards |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
extracting specific rows
Joel
i pasted the code into a VB module, press F5 and then get the message: "run time error "438" Object does not support this property or method" "Joel" wrote: Sub extractsinglenames() NewRowCount = 2 With ActiveSheet LastRow = .Range("C" & Rows.Count).End(xlUp).Row 'copy header row .Row(1).Copy Destination:=Sheets("Sheet2").Rows(1) For RowCount = 2 To LastRow If InStr(.Range("C" & RowCount), " ") = 0 Then .Row(RowCount).Copy _ Destination:=Sheets("Sheet2").Rows(NewRowCount) NewRowCount = NewRowCount + 1 End If Next RowCount End With End Sub Sub extractmultinames() NewRowCount = 2 With ActiveSheet LastRow = .Range("C" & Rows.Count).End(xlUp).Row 'copy header row .Row(1).Copy Destination:=Sheets("Sheet2").Rows(1) For RowCount = 2 To LastRow If InStr(.Range("C" & RowCount), " ") 0 Then .Row(RowCount).Copy _ Destination:=Sheets("Sheet2").Rows(NewRowCount) NewRowCount = NewRowCount + 1 End If Next RowCount End With "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 does either have only one name or more than one name. Any ideas in terms of a macro or function? Regards |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
extracting specific rows
Sorry, in a couple o spots I typed Row (no s) instead of Rows.
Sub extractsinglenames() NewRowCount = 2 With ActiveSheet LastRow = .Range("C" & Rows.Count).End(xlUp).Row 'copy header row .Rows(1).Copy Destination:=Sheets("Sheet2").Rows(1) For RowCount = 2 To LastRow If InStr(.Range("C" & RowCount), " ") = 0 Then .Rows(RowCount).Copy _ Destination:=Sheets("Sheet2").Rows(NewRowCount) NewRowCount = NewRowCount + 1 End If Next RowCount End With End Sub Sub extractmultinames() NewRowCount = 2 With ActiveSheet LastRow = .Range("C" & Rows.Count).End(xlUp).Row 'copy header row .Rows(1).Copy Destination:=Sheets("Sheet2").Rows(1) For RowCount = 2 To LastRow If InStr(.Range("C" & RowCount), " ") 0 Then .Row(sRowCount).Copy _ Destination:=Sheets("Sheet2").Rows(NewRowCount) NewRowCount = NewRowCount + 1 End If Next RowCount End With "wynand" wrote: Joel i pasted the code into a VB module, press F5 and then get the message: "run time error "438" Object does not support this property or method" "Joel" wrote: Sub extractsinglenames() NewRowCount = 2 With ActiveSheet LastRow = .Range("C" & Rows.Count).End(xlUp).Row 'copy header row .Row(1).Copy Destination:=Sheets("Sheet2").Rows(1) For RowCount = 2 To LastRow If InStr(.Range("C" & RowCount), " ") = 0 Then .Row(RowCount).Copy _ Destination:=Sheets("Sheet2").Rows(NewRowCount) NewRowCount = NewRowCount + 1 End If Next RowCount End With End Sub Sub extractmultinames() NewRowCount = 2 With ActiveSheet LastRow = .Range("C" & Rows.Count).End(xlUp).Row 'copy header row .Row(1).Copy Destination:=Sheets("Sheet2").Rows(1) For RowCount = 2 To LastRow If InStr(.Range("C" & RowCount), " ") 0 Then .Row(RowCount).Copy _ Destination:=Sheets("Sheet2").Rows(NewRowCount) NewRowCount = NewRowCount + 1 End If Next RowCount End With "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 does either have only one name or more than one name. Any ideas in terms of a macro or function? Regards |
#5
Posted to microsoft.public.excel.misc
|
|||
|
|||
extracting specific rows
Joel
Thank you single names is working excellent. Multi names shows the following debug error: .Row(sRowCount).Copy _ Destination:=Sheets("Sheet2").Rows(NewRowCount)' "Joel" wrote: Sorry, in a couple o spots I typed Row (no s) instead of Rows. Sub extractsinglenames() NewRowCount = 2 With ActiveSheet LastRow = .Range("C" & Rows.Count).End(xlUp).Row 'copy header row .Rows(1).Copy Destination:=Sheets("Sheet2").Rows(1) For RowCount = 2 To LastRow If InStr(.Range("C" & RowCount), " ") = 0 Then .Rows(RowCount).Copy _ Destination:=Sheets("Sheet2").Rows(NewRowCount) NewRowCount = NewRowCount + 1 End If Next RowCount End With End Sub Sub extractmultinames() NewRowCount = 2 With ActiveSheet LastRow = .Range("C" & Rows.Count).End(xlUp).Row 'copy header row .Rows(1).Copy Destination:=Sheets("Sheet2").Rows(1) For RowCount = 2 To LastRow If InStr(.Range("C" & RowCount), " ") 0 Then .Row(sRowCount).Copy _ Destination:=Sheets("Sheet2").Rows(NewRowCount) NewRowCount = NewRowCount + 1 End If Next RowCount End With "wynand" wrote: Joel i pasted the code into a VB module, press F5 and then get the message: "run time error "438" Object does not support this property or method" "Joel" wrote: Sub extractsinglenames() NewRowCount = 2 With ActiveSheet LastRow = .Range("C" & Rows.Count).End(xlUp).Row 'copy header row .Row(1).Copy Destination:=Sheets("Sheet2").Rows(1) For RowCount = 2 To LastRow If InStr(.Range("C" & RowCount), " ") = 0 Then .Row(RowCount).Copy _ Destination:=Sheets("Sheet2").Rows(NewRowCount) NewRowCount = NewRowCount + 1 End If Next RowCount End With End Sub Sub extractmultinames() NewRowCount = 2 With ActiveSheet LastRow = .Range("C" & Rows.Count).End(xlUp).Row 'copy header row .Row(1).Copy Destination:=Sheets("Sheet2").Rows(1) For RowCount = 2 To LastRow If InStr(.Range("C" & RowCount), " ") 0 Then .Row(RowCount).Copy _ Destination:=Sheets("Sheet2").Rows(NewRowCount) NewRowCount = NewRowCount + 1 End If Next RowCount End With "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 does either have only one name or more than one name. Any ideas in terms of a macro or function? Regards |
#6
Posted to microsoft.public.excel.misc
|
|||
|
|||
extracting specific rows
I put the S in the wrong place
from .Row(sRowCount).Copy _ Destination:=Sheets("Sheet2").Rows(NewRowCount)' to .Rows(RowCount).Copy _ Destination:=Sheets("Sheet2").Rows(NewRowCount)' The two macros are the same except for on e line of code If InStr(.Range("C" & RowCount), " ") = 0 Then and If InStr(.Range("C" & RowCount), " ") 0 Then "wynand" wrote: Joel Thank you single names is working excellent. Multi names shows the following debug error: .Row(sRowCount).Copy _ Destination:=Sheets("Sheet2").Rows(NewRowCount)' "Joel" wrote: Sorry, in a couple o spots I typed Row (no s) instead of Rows. Sub extractsinglenames() NewRowCount = 2 With ActiveSheet LastRow = .Range("C" & Rows.Count).End(xlUp).Row 'copy header row .Rows(1).Copy Destination:=Sheets("Sheet2").Rows(1) For RowCount = 2 To LastRow If InStr(.Range("C" & RowCount), " ") = 0 Then .Rows(RowCount).Copy _ Destination:=Sheets("Sheet2").Rows(NewRowCount) NewRowCount = NewRowCount + 1 End If Next RowCount End With End Sub Sub extractmultinames() NewRowCount = 2 With ActiveSheet LastRow = .Range("C" & Rows.Count).End(xlUp).Row 'copy header row .Rows(1).Copy Destination:=Sheets("Sheet2").Rows(1) For RowCount = 2 To LastRow If InStr(.Range("C" & RowCount), " ") 0 Then .Row(sRowCount).Copy _ Destination:=Sheets("Sheet2").Rows(NewRowCount) NewRowCount = NewRowCount + 1 End If Next RowCount End With "wynand" wrote: Joel i pasted the code into a VB module, press F5 and then get the message: "run time error "438" Object does not support this property or method" "Joel" wrote: Sub extractsinglenames() NewRowCount = 2 With ActiveSheet LastRow = .Range("C" & Rows.Count).End(xlUp).Row 'copy header row .Row(1).Copy Destination:=Sheets("Sheet2").Rows(1) For RowCount = 2 To LastRow If InStr(.Range("C" & RowCount), " ") = 0 Then .Row(RowCount).Copy _ Destination:=Sheets("Sheet2").Rows(NewRowCount) NewRowCount = NewRowCount + 1 End If Next RowCount End With End Sub Sub extractmultinames() NewRowCount = 2 With ActiveSheet LastRow = .Range("C" & Rows.Count).End(xlUp).Row 'copy header row .Row(1).Copy Destination:=Sheets("Sheet2").Rows(1) For RowCount = 2 To LastRow If InStr(.Range("C" & RowCount), " ") 0 Then .Row(RowCount).Copy _ Destination:=Sheets("Sheet2").Rows(NewRowCount) NewRowCount = NewRowCount + 1 End If Next RowCount End With "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 does either have only one name or more than one name. Any ideas in terms of a macro or function? Regards |
#7
Posted to microsoft.public.excel.misc
|
|||
|
|||
extracting specific rows
thanks works great!!
"Joel" wrote: I put the S in the wrong place from .Row(sRowCount).Copy _ Destination:=Sheets("Sheet2").Rows(NewRowCount)' to .Rows(RowCount).Copy _ Destination:=Sheets("Sheet2").Rows(NewRowCount)' The two macros are the same except for on e line of code If InStr(.Range("C" & RowCount), " ") = 0 Then and If InStr(.Range("C" & RowCount), " ") 0 Then "wynand" wrote: Joel Thank you single names is working excellent. Multi names shows the following debug error: .Row(sRowCount).Copy _ Destination:=Sheets("Sheet2").Rows(NewRowCount)' "Joel" wrote: Sorry, in a couple o spots I typed Row (no s) instead of Rows. Sub extractsinglenames() NewRowCount = 2 With ActiveSheet LastRow = .Range("C" & Rows.Count).End(xlUp).Row 'copy header row .Rows(1).Copy Destination:=Sheets("Sheet2").Rows(1) For RowCount = 2 To LastRow If InStr(.Range("C" & RowCount), " ") = 0 Then .Rows(RowCount).Copy _ Destination:=Sheets("Sheet2").Rows(NewRowCount) NewRowCount = NewRowCount + 1 End If Next RowCount End With End Sub Sub extractmultinames() NewRowCount = 2 With ActiveSheet LastRow = .Range("C" & Rows.Count).End(xlUp).Row 'copy header row .Rows(1).Copy Destination:=Sheets("Sheet2").Rows(1) For RowCount = 2 To LastRow If InStr(.Range("C" & RowCount), " ") 0 Then .Row(sRowCount).Copy _ Destination:=Sheets("Sheet2").Rows(NewRowCount) NewRowCount = NewRowCount + 1 End If Next RowCount End With "wynand" wrote: Joel i pasted the code into a VB module, press F5 and then get the message: "run time error "438" Object does not support this property or method" "Joel" wrote: Sub extractsinglenames() NewRowCount = 2 With ActiveSheet LastRow = .Range("C" & Rows.Count).End(xlUp).Row 'copy header row .Row(1).Copy Destination:=Sheets("Sheet2").Rows(1) For RowCount = 2 To LastRow If InStr(.Range("C" & RowCount), " ") = 0 Then .Row(RowCount).Copy _ Destination:=Sheets("Sheet2").Rows(NewRowCount) NewRowCount = NewRowCount + 1 End If Next RowCount End With End Sub Sub extractmultinames() NewRowCount = 2 With ActiveSheet LastRow = .Range("C" & Rows.Count).End(xlUp).Row 'copy header row .Row(1).Copy Destination:=Sheets("Sheet2").Rows(1) For RowCount = 2 To LastRow If InStr(.Range("C" & RowCount), " ") 0 Then .Row(RowCount).Copy _ Destination:=Sheets("Sheet2").Rows(NewRowCount) NewRowCount = NewRowCount + 1 End If Next RowCount End With "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 does 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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Extracting characters before or after a specific character | Excel Worksheet Functions | |||
extracting specific values and replacing in set column | Excel Discussion (Misc queries) | |||
Extracting specific word in a cell | Excel Worksheet Functions | |||
Extracting specific data from a cell | Excel Worksheet Functions | |||
Pivot Table - Extracting specific data | Excel Worksheet Functions |