Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I have two excel sheet. I am trying to copy a name from list of names in sheet1, find it in sheet2 - copy the entire column (which contains the name )and paste it into another column in sheet2. The macro works perfectly fine until I hit a name that is not is in sheet2. When I put' On error goto....'it works fine if it is after the Exit sub. It does not work otherwise. This is what I want -When it hits a name that is not in sheet2, I want it to go to the next name in sheet1 and continue with the process. Any help would be appreciated! Dim x As Range Sheets("Sheet1").Select Set x = Range("A1") Do x.Select If ActiveCell.Value = "" Then Exit Sub End If Application.CutCopyMode = False Selection.Copy Sheets("Req and Status").Select Rows("1:1").Select 'On Error GoTo message Selection.Find(What:=x, After:=ActiveCell, LookIn:= _ xlFormulas, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:= _ xlNext, MatchCase:=False, SearchFormat:=False).Activate ActiveCell.Select Range(Selection, Selection.End(xlDown)).Select Application.CutCopyMode = False Selection.Cut Columns("C:C").Select Selection.Insert Shift:=xlToRight Sheets("Sheet1").Select Set x = x.Offset(1) Loop End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro - 2 Sheets - Find/Insert/Copy/Paste | Excel Programming | |||
Find/Copy/paste.. then Find/Paste - not working ... at all.... | Excel Programming | |||
Macro to find copy "header" and paste | Excel Discussion (Misc queries) | |||
Macro to find, copy, and paste until value change | Excel Worksheet Functions | |||
Copy and Paste macro needs to paste to a changing cell reference | Excel Programming |