Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I want to search for a match to an identifier in Column A of Sheet1. If
found, copy the whole of the associated row to Sheet2, where other columns will be added after the copied data. If not found, return a "Not found" message. There could be up to 12000 rows in main worksheet. Relatively novice user so nothing too complicated, please! |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi,
A starter. It assumes your Identifier is TEXT Sub GetMatch(ByVal MatchKey As String, ByVal MatchRng As Range) res = Application.Match(MatchKey, MatchRng, 0) If IsError(res) Then MsgBox " No match found for " & MatchKey Else Worksheets("Sheet1").Cells(res, "A").EntireRow.Copy _ Worksheets("sheet2").Cells(Rows.Count, "A").End(xlUp)(2) End If End Sub Sub test() Set rng = Worksheets("Sheet1").Range("A1:a12000") '<=== Change to suit but start at A1 ' Add a loop to go through your ID s Call GetMatch("5", rng) End Sub HTH "UNISON Issy" wrote: I want to search for a match to an identifier in Column A of Sheet1. If found, copy the whole of the associated row to Sheet2, where other columns will be added after the copied data. If not found, return a "Not found" message. There could be up to 12000 rows in main worksheet. Relatively novice user so nothing too complicated, please! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Range Name from Another Workbook conflicts with INDEX and INDIRECT | Excel Worksheet Functions | |||
copy workbook sheets? | Setting up and Configuration of Excel | |||
Copy and paste from 1 workbook to another | Excel Worksheet Functions | |||
copy COLUMN from 1 worksheet to another (in a different workbook) | Excel Discussion (Misc queries) | |||
copy worksheet from closed workbook to active workbook using vba | Excel Worksheet Functions |