Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Need a macro to copy all rows with the text "sh cam" from
column A to column B. This is an example only shows 3 examples but my excel spreadsheet has over 2000. Column A Jim Glover sh cam 00-08-74-34-48 Tammy Smith sh cam 00-75-38-d9-39 Sam Dover sh cam 00-08-28-23-23 Thanks Sarah |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub Move_A_to_B()
For MyRow = 1 To 2000 ' change 2000 to your last row MyValue = Range("a" & MyRow).Value If Left(MyValue, 6) = "sh cam" Then Range("b" & MyRow).Value = "sh cam" Range("a" & MyRow).ClearContents End If Next MyRow End Sub |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dim rng as Range, rng1 as Range
Dim sForm as String columns(2).Insert set rng = Range(cells(1,1),cells(rows.count,1).End(xlup)) sForm = "=IF(ISERROR(SEARCH(""sh cam"",A1)),"""",NA())" rng.offset(0,1).Formla = sForm on Error Resume Next set rng1 = rng.offset(0,1).SpecialCells(xlFormulas,xlErrors) set rng1 = Intersect(Columns(1),rng1.EntireRow) On Error goto 0 columns(2).Delete if not rng1 is nothing then rng1.EntireRow.copy Destination:= _ worksheets("sheet2").Range("A1") End if -- Regards, Tom Ogilvy "Sarah" wrote in message ... Need a macro to copy all rows with the text "sh cam" from column A to column B. This is an example only shows 3 examples but my excel spreadsheet has over 2000. Column A Jim Glover sh cam 00-08-74-34-48 Tammy Smith sh cam 00-75-38-d9-39 Sam Dover sh cam 00-08-28-23-23 Thanks Sarah |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
THANKS ALOT!!!!!!!!!!!!!!!!!!!!!!!!!
WORKS PERFECT -----Original Message----- Dim rng as Range, rng1 as Range Dim sForm as String columns(2).Insert set rng = Range(cells(1,1),cells(rows.count,1).End(xlup)) sForm = "=IF(ISERROR(SEARCH(""sh cam"",A1)),"""",NA())" rng.offset(0,1).Formla = sForm on Error Resume Next set rng1 = rng.offset(0,1).SpecialCells (xlFormulas,xlErrors) set rng1 = Intersect(Columns(1),rng1.EntireRow) On Error goto 0 columns(2).Delete if not rng1 is nothing then rng1.EntireRow.copy Destination:= _ worksheets("sheet2").Range("A1") End if -- Regards, Tom Ogilvy "Sarah" wrote in message ... Need a macro to copy all rows with the text "sh cam" from column A to column B. This is an example only shows 3 examples but my excel spreadsheet has over 2000. Column A Jim Glover sh cam 00-08-74-34-48 Tammy Smith sh cam 00-75-38-d9-39 Sam Dover sh cam 00-08-28-23-23 Thanks Sarah . |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sarah:
If the answers you got are to complicated let me know. -----Original Message----- Need a macro to copy all rows with the text "sh cam" from column A to column B. This is an example only shows 3 examples but my excel spreadsheet has over 2000. Column A Jim Glover sh cam 00-08-74-34-48 Tammy Smith sh cam 00-75-38-d9-39 Sam Dover sh cam 00-08-28-23-23 Thanks Sarah . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to copy text between two different delimeters | New Users to Excel | |||
copy text from 1 workbook to another by macro | Excel Worksheet Functions | |||
Adding new numbers as I type without duplicates from Sheet1,ColumnA to Sheet2,ColumnA | Excel Worksheet Functions | |||
Macro to delete a text box and copy in new one | Excel Discussion (Misc queries) | |||
Macro to copy daily text file | Excel Programming |