Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
KJM KJM is offline
external usenet poster
 
Posts: 6
Default How to merge multiple rows of data to new formated sheets

PROBLEM:

I have a single RC sheet of project data in an Excel workbook.

I need to automatically merge each rows of data from select columns of the
Main_Sheet to specific cell locations in a NewSheet. (Basically the equivlent
of a Merge in Word)

There are approx. 150 records (rows) and ultimately, each should be in its
own sheet, all with a common format different than the MainSheet.

The NewSheet will later be extracted to seperate Excel files.

I have found macros that convert the row data to seperate sheets.
I also have found a macro that will convert the seperate sheets into
seperate Excel files.

However, I am unable to find a way for the NewSheet to use a template or
automatically format as needed.

I am also unable to determine how to have the MainSheet row/column data
populate the specific cell location. (i.e. Row data in MainSheet Column B
should poplulate the NewSheet in Row 5, Row 5 Column D).

I'm wondering if using a form will help, but the cell mapping still escapes
me?

SAMPLE SHEET TO FILE MACRO per author Rob Bovey is:

Sub Copy_All_Sheets_To_New_Workbook()
Dim FName As Variant
Dim WbMain As Workbook
Dim Wb As Workbook
Dim sh As Worksheet
Dim MyPath As String
Dim SaveDriveDir As String
Dim DateString As String
Dim FolderName As String

SaveDriveDir = CurDir
MyPath = Application.DefaultFilePath 'Or use a path like this "C:\Data"
ChDrive MyPath
ChDir MyPath

FName = Application.GetOpenFilename(filefilter:="Excel Files (*.xls),
*.xls")
If FName < False Then
If bIsBookOpen(Dir(FName)) Then
MsgBox "The file is already open"
Else
Application.ScreenUpdating = False
DateString = Format(Now, "yy-mm-dd hh-mm-ss")
Set WbMain = Workbooks.Open(FName)
MkDir WbMain.Path & "\" & WbMain.Name & " " & DateString
FolderName = WbMain.Path & "\" & WbMain.Name & " " & DateString

For Each sh In WbMain.Worksheets
If sh.Visible = -1 Then
sh.Copy
Set Wb = ActiveWorkbook
Wb.SaveAs FolderName _
& "\" & Wb.Sheets(1).Name & ".xls"
Wb.Close False
Set Wb = Nothing
End If
Next sh
MsgBox "Look in " & FolderName & " for the files"
WbMain.Close False
Application.ScreenUpdating = True
End If
End If
ChDrive SaveDriveDir
ChDir SaveDriveDir
End Sub

Function bIsBookOpen(ByRef szBookName As String) As Boolean
' Rob Bovey
On Error Resume Next
bIsBookOpen = Not (Application.Workbooks(szBookName) Is Nothing)
End Function


SAMPLE ROWS TO SHEET MACRO per Debra Dalgleish, Contextures

Sub ExtractReps()
Dim ws1 As Worksheet
Dim wsNew As Worksheet
Dim rng As Range
Dim r As Integer
Dim c As Range
Set ws1 = Sheets("Sheet.1")
Set rng = Range("Database")

'extract a list of Sales Reps
ws1.Columns("C:C").AdvancedFilter _
Action:=xlFilterCopy, _
CopyToRange:=Range("J1"), Unique:=True
r = Cells(Rows.Count, "J").End(xlUp).Row

'set up Criteria Area
Range("L1").Value = Range("C1").Value

For Each c In Range("J2:J" & r)
'add the rep name to the criteria area
ws1.Range("L2").Value = c.Value
'add new sheet and run advanced filter
Set wsNew = Sheets.Add
wsNew.Move After:=Worksheets(Worksheets.Count)
wsNew.Name = c.Value
rng.AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Sheets("Sheet1").Range("L1:L2"), _
CopyToRange:=wsNew.Range("A1"), _
Unique:=False
Next
ws1.Select
ws1.Columns("J:L").Delete
End Sub


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
Combin / Merge Multiple Worksheets / sheets into one worksheet / sheet [email protected] Excel Worksheet Functions 3 December 14th 06 02:13 AM
Linking Multiple Rows to Use in Mail Merge Exhausted... Excel Discussion (Misc queries) 4 November 12th 06 02:20 AM
merge data from many sheets to one jb Excel Worksheet Functions 1 March 20th 06 06:14 PM
How can I merge multiple sheets from different Excel files workbo. jones021 Excel Worksheet Functions 0 April 20th 05 08:48 PM
is there an easy way to merge data/information on several sheets . Robin Excel Discussion (Misc queries) 1 February 10th 05 03:12 PM


All times are GMT +1. The time now is 02:09 AM.

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"