LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 852
Default Copy to sheet name in column 1

Trying to copy AREAs to the sheet of the employee whose name is the same as "Ar" in the - For Each Ar In Columns("A").SpecialCells(xlConstants).Areas

If current Ar = Name 1 then the AREA should go to the sheet named Name 1.

I'm using Name 1, Name 2 etc, as sheet names and employee names.

"Main" sheet column 1 has Name n and data for Name n is in columns B to E down any number of rows. Say 5 to 45, varies.

There is a one blank row between AREAs.

The "Set ArCpy As..." works just fine, can't get the copy-to-sheet-name thing correct.

Thanks,
Howard

Sub Staff_Info_To_Staff_Sheet()
Dim Ar As Range
Dim ArRow As Long, ArDwn As Long
Dim ArCpy As Range
Dim sNme As Worksheet

For Each Ar In Columns("A").SpecialCells(xlConstants).Areas

ArDwn = Ar.Offset(, 1).End(xlDown).Row
'Set sNme.Name = Ar.Offset(0, 0)
Set ArCpy = Range(Cells(Ar.Row, 2), Cells(ArDwn, 5))

ArCpy.Copy Sheets(sNme).Range("A" & Rows.Count).End(xlUp)(2)

Next

End Sub
 
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
How to copy every Nth column to a new sheet Ceywood New Users to Excel 1 August 30th 12 08:23 AM
Code to copy column in sheet 1 to column in sheet 2 based on matched criteria skitsoni Excel Programming 1 July 14th 12 11:25 AM
Match value from column A to column A on 2nd sheet and then copy R DanS Excel Programming 2 February 16th 09 09:03 PM
How to search column, copy row, and copy to another sheet in same Rockhound Excel Discussion (Misc queries) 1 December 9th 06 04:16 PM
how to make one column copy from one sheet to anoth column w/o zer areezm Excel Discussion (Misc queries) 3 June 6th 06 10:45 PM


All times are GMT +1. The time now is 04:57 PM.

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"