Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I have a workbook with two sheets. Sheet one has customer information with
account numbers in column A. I need a macro that will allow me to search for an account number. When it finds the account number, it will cut the entire row and paste it into the next empty row in sheet 2 in the workbook. All methods I have tried have failed so any help is appreciated. I am using Excel 2007. Thanks in advance. |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Execute while on the source sheet.
Sub findandcopy() what = 33 'youracctnum mr = Columns("A").Find(what, After:=Cells(1, 1), _ LookIn:=xlValues, LookAt:=xlWhole, _ SearchOrder:=xlByRows, SearchDirection:=xlNext).Row With Sheets("sheet2") dlr = .Cells(Rows.Count, "A").End(xlUp).Row + 1 Rows(mr).Copy .Rows(dlr) End With End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "brodiemac" wrote in message ... I have a workbook with two sheets. Sheet one has customer information with account numbers in column A. I need a macro that will allow me to search for an account number. When it finds the account number, it will cut the entire row and paste it into the next empty row in sheet 2 in the workbook. All methods I have tried have failed so any help is appreciated. I am using Excel 2007. Thanks in advance. |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I get the error Object variable or With block not set.
"Don Guillett" wrote: Execute while on the source sheet. Sub findandcopy() what = 33 'youracctnum mr = Columns("A").Find(what, After:=Cells(1, 1), _ LookIn:=xlValues, LookAt:=xlWhole, _ SearchOrder:=xlByRows, SearchDirection:=xlNext).Row With Sheets("sheet2") dlr = .Cells(Rows.Count, "A").End(xlUp).Row + 1 Rows(mr).Copy .Rows(dlr) End With End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "brodiemac" wrote in message ... I have a workbook with two sheets. Sheet one has customer information with account numbers in column A. I need a macro that will allow me to search for an account number. When it finds the account number, it will cut the entire row and paste it into the next empty row in sheet 2 in the workbook. All methods I have tried have failed so any help is appreciated. I am using Excel 2007. Thanks in advance. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Move Column within Sheet with VB Macro | Excel Discussion (Misc queries) | |||
Move Macro Button on Sheet to a toolbar | Excel Discussion (Misc queries) | |||
Macro to move data from one sheet to another | Excel Discussion (Misc queries) | |||
How do move folders from web based email account to outlook? | Excel Discussion (Misc queries) | |||
Macro - Find a value and then move down | Excel Discussion (Misc queries) |