Hi..
I have 1 workbook with data pertaining to different managers.. Want to
make different worksheets for different planners.. Please help..
Thanks
JCquot;JCquot; wrote:
gt; .. I have 1 workbook with data pertaining to different managers
gt; Want to make different worksheets for different planners..
Perhaps one way ..
Try this previous response to a similar query:
tinyurl.com/kwsgw
A new link to the sample construct therein is at:
cjoint.com/?cwlqnxXxgn
AutoSortData_BySheetName.xls
(previous link to sample expired)
--
Max
Singapore
savefile.com/projects/236895
xdemechanik
---
Hi JC,
Problem statement is not so clear. But you can use one of the following ways
to seperate related data
1. Pivot tables
2. Autofilter
on DATA menu.
Regards
NAVEEN
quot;JCquot; wrote:
gt; Hi..
gt;
gt; I have 1 workbook with data pertaining to different managers.. Want to
gt; make different worksheets for different planners.. Please help..
gt;
gt; Thanks
gt; JC
gt;
gt;
Hi JC
Try this
www.rondebruin.nl/copy5.htm--
Regards Ron de Bruin
www.rondebruin.nlquot;JCquot; gt; wrote in message oups.com...
gt; Hi..
gt;
gt; I have 1 workbook with data pertaining to different managers.. Want to
gt; make different worksheets for different planners.. Please help..
gt;
gt; Thanks
gt; JC
gt;
Try this
Sub FanOut()
Dim ColHead As String
Dim ColHeadCell As Range
Dim iCol As Integer
Dim iRow As Long 'row index on Fan Data sheet
Dim lRow As Integer 'row index on individual destination sheet
Dim NewWB As Workbook
Dim Dsheet As Worksheet 'destination worksheet
Dim Fsheet As Worksheet 'fan data worksheet (assumed active)
Again:
ColHead = InputBox(quot;Enter Column Headingquot;, quot;Identify Columnquot;, [H1].Value)
If ColHead = quot;quot; Then Exit Sub
Set ColHeadCell = Rows(1).Find(ColHead, lookat:=xlWhole)
If ColHeadCell Is Nothing Then
MsgBox quot;Heading not found in row 1quot;
GoTo Again
End If
Set Fsheet = ActiveSheet
Set NewWB = Workbooks.Add
iCol = ColHeadCell.Column
'loop through values in selected column
For iRow = 2 To Fsheet.Cells(65536, iCol).End(xlUp).Row
If Not SheetExists(CStr(Fsheet.Cells(iRow, iCol).Value)) Then
Set Dsheet =
NewWB.Worksheets.Add(after:=NewWB.Worksheets(NewWB .Worksheets.Count))
Dsheet.Name = CStr(Fsheet.Cells(iRow, iCol).Value)
Else
Set Dsheet = Worksheets(CStr(Fsheet.Cells(iRow, iCol).Value))
End If
lRow = Dsheet.Cells(65536, iCol).End(xlUp).Row
Fsheet.Rows(iRow).Copy Destination:=Dsheet.Rows(lRow 1)
Next iRow
End Sub
Function SheetExists(SheetId As Variant) As Boolean
' This function checks whether a sheet (can be a worksheet,
' chart sheet, dialog sheet, etc.) exists, and returns
' True if it exists, False otherwise. SheetId can be either
' a sheet name string or an integer number. For example:
' If SheetExists(3) Then Sheets(3).Delete
' deletes the third worksheet in the workbook, if it exists.
' Similarly,
' If SheetExists(quot;Annual Budgetquot;) Then Sheets(quot;Annual Budgetquot;).Delete
' deletes the sheet named quot;Annual Budgetquot;, if it exists.
Dim Sh As Object
On Error GoTo NoSuch
Set Sh = Sheets(SheetId)
SheetExists = True
Exit Function
NoSuch:
If Err = 9 Then SheetExists = False Else Stop
End Functionquot;JCquot; wrote:
gt; Hi..
gt;
gt; I have 1 workbook with data pertaining to different managers.. Want to
gt; make different worksheets for different planners.. Please help..
gt;
gt; Thanks
gt; JC
gt;
gt;
- May 16 Wed 2007 20:37
Workbook to different worksheets
close
全站熱搜
留言列表
發表留言