Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 61
Default Is there a macro to...

Is there a macro that would make it possible to lookup a certain name in a
column and anytime it finds that name it will copy a range of cells and paste
it into another worksheet? I.E. anytime the name Jim Smith is found in the
range A5:A200 it returns a range of cells next to it...if Jim Smith was found
in A5, it would copy cells C5:FN9 and paste them in a specified location on
another sheet

Right now I have it copying all colmns from the master sheet and if the name
is not assigned to that project it will return a 0, then I have a macro to
hide all rows that equal 0. Is there a better way to do this? Any hints on
the best way to do this?
Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 208
Default Is there a macro to...

A quick way to do this would be to use autofilter.

select the row with the titles, enable autofilter, set the filter on
the name column to equal the value you want to return, then copy all
VISIBLE cells to a new worksheet

Here's a sample (assumes name is in column A)
Sub Macro1()
'
'
Dim cursheet As Worksheet
Dim searchstring As String

Set cursheet = ActiveSheet
searchstring = InputBox("Enter Name: ")
Rows("1:1").AutoFilter Field:=1, Criteria1:=searchstring

Cells.Select
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Copy
Sheets.Add
ActiveSheet.Paste

cursheet.Select
Selection.AutoFilter Field:=1
Application.CutCopyMode = False
Range("A1").Select


End Sub

On Jul 24, 8:09*am, lightbulb
wrote:
Is there a macro that would make it possible to lookup a certain name in a
column and anytime it finds that name it will copy a range of cells and paste
it into another worksheet? *I.E. anytime the name Jim Smith is found in the
range A5:A200 it returns a range of cells next to it...if Jim Smith was found
in A5, it would copy cells C5:FN9 and paste them in a specified location on
another sheet

Right now I have it copying all colmns from the master sheet and if the name
is not assigned to that project it will return a 0, then I have a macro to
hide all rows that equal 0. *Is there a better way to do this? *Any hints on
the best way to do this?
Thanks!


Reply
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
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 1 February 5th 07 09:31 PM
using a cell value to control a counter inside a macro and displaying macro value ocset Excel Worksheet Functions 1 September 10th 06 05:32 AM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 1 June 11th 05 12:44 AM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 0 June 10th 05 03:38 PM


All times are GMT +1. The time now is 04:48 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"