Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copy Rows from one worksheet to another by entering the Name of the Staff


I have 2 workbooks, Staff_BU and Staff.

Now on Staff_BU, I have a cell (call it cell A13). When I enter let
say "Mr Ang" in cell "A13", I want the macro to look for that sam
Character "Mr Ang" on 'Staff' worksheet. under the row "Mr Ang", I wan
to insert this line on Row 13, on Staff_BU. It must start at Row 13.

and after copying the first Staff ID "Mr Ang", the macro is able t
insert another new Staff ID let's say "David" into the next ro
availble, lets say Row 14, and the third Staff ID, the fourth an
continue.

i have the code as below,
i am able to copy and paste the first Staff onto Sheet2, but i have n
idea how to continue the loop to paste the another Staff after row 19
and the third staff at row 20.

any 1 have any ideas how to?

Code:

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A13")) Is Nothing Then
Dim GetSht As Worksheet, PutSht As Worksheet, c As Range, r A
String

Set GetSht = Sheet4
Set PutSht = Sheet2

PutSht.Range(Cells(18, 1), Cells(Rows.Count, 4).End(xlUp)).Show

r = 18
For Each c In GetSht.Range(GetSht.Cells(9, 2)
GetSht.Cells(Rows.Count, 1).End(xlUp))
If c = PutSht.Range("A13") Then
GetSht.Range(c, c.Offset(0, 99)).Copy PutSht.Cells(r, 1)
r = r + 1
End If
Next c
Application.CutCopyMode = False
End If
End Su

--
new_to_vb
-----------------------------------------------------------------------
new_to_vba's Profile: http://www.excelforum.com/member.php...fo&userid=3013
View this thread: http://www.excelforum.com/showthread.php?threadid=49820

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
Copy rows from one worksheet automatically, ignore rows that are b Kris Excel Worksheet Functions 2 October 10th 08 09:28 PM
Excel Staff Hours Worksheet... DB Excel Discussion (Misc queries) 1 April 9th 07 08:08 PM
Staff availability worksheet John N Excel Discussion (Misc queries) 3 February 22nd 06 10:36 AM
how many staff have 1 skill, how many staff have 2 skills, etc. ch90 Excel Discussion (Misc queries) 3 October 27th 05 03:52 PM


All times are GMT +1. The time now is 03:48 AM.

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

About Us

"It's about Microsoft Excel"