LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 29
Default 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!!
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Please help - Find & copy Macro Damil4real Excel Worksheet Functions 1 May 7th 09 02:30 PM
Find and Copy down macro Barry McConnell Excel Discussion (Misc queries) 4 July 1st 08 08:00 AM
macro to copy range Frank Situmorang[_2_] Excel Worksheet Functions 7 June 3rd 08 09:54 AM
FIND-COPY DIFFERENT WORDS WITH MACRO Spiros Excel Discussion (Misc queries) 3 September 27th 07 01:20 PM
FIND-COPY DIFFERENT WORDS WITH MACRO Spiros Excel Discussion (Misc queries) 1 September 27th 07 11:43 AM


All times are GMT +1. The time now is 01:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"