Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Macro to find value and then copy associated range
Hi,
Using Excel 2003 I've tried to piece together a macro to find a cell in one worksheet and the then set the range based on that found cell... copy and paste to another worksheet. It's not quite working and I can't figure out why. Any help would, once again, be greatly appreciated. Code is as follows Sub addhatchinfo() Worksheets("Hatchability Data").Activate Dim FindWhat As String Dim FoundCell As Range Dim cpyrng As Range FindWhat = InputBox("Enter the Tracking Number here") Worksheets("Viability Data").Activate 'On Error Resume Next Set FoundCell = Range("d:d").Find(what:=FindWhat, _ lookat:=xlPart, LookIn:=xlValues) FoundCell.Activate x = ActiveCell.Row Set cpyrng = Range(Cells(x, "a"), Cells(x, "aj")) Range(cpyrng).Select Selection.Copy Worksheets("Hatchability Data").Activate Range("A65536").End(xlUp).Offset(1, 0).Select ActiveCell.Paste End Sub Happy New Year to all!! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Please help - Find & copy Macro | Excel Worksheet Functions | |||
Find and Copy down macro | Excel Discussion (Misc queries) | |||
macro to copy range | Excel Worksheet Functions | |||
FIND-COPY DIFFERENT WORDS WITH MACRO | Excel Discussion (Misc queries) | |||
FIND-COPY DIFFERENT WORDS WITH MACRO | Excel Discussion (Misc queries) |