View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick[_2_] Bernie Deitrick[_2_] is offline
external usenet poster
 
Posts: 176
Default Report Question?

Michael,

Try the code below, with the sheet active. This assumes there are
headers in row 1.

HTH,
Bernie
MS Excel MVP

Sub TryNow()
Dim myCell As Range
Dim myRange As Range
Dim mySht As Worksheet
Dim mySrc As Worksheet
Dim myVal As String

Application.ScreenUpdating = False
ActiveSheet.Copy Sheets(1)
Set mySrc = ActiveSheet
Set myRange = mySrc.Range("B2:J3788")
While Application.CountBlank(myRange) < myRange.Cells.Count
Set myRange = myRange.SpecialCells(xlCellTypeConstants, 2)
myVal = myRange(1).Value
Set mySht = Worksheets.Add
mySrc.Activate
mySht.Name = myVal
mySht.Range("A:A").NumberFormat = "mm/dd/yyyy"
For Each myCell In myRange
If myCell.Value = myVal Then
With mySht.Range("A65536").End(xlUp)(2)
.Value = Cells(myCell.Row, 1).Value
.Offset(0, 1).Value = myCell.Value
End With
myCell.ClearContents
End If
Next myCell
mySht.Range("A:B").EntireColumn.AutoFit
Set myRange = mySrc.Range("B2:J3788")
Wend
Application.DisplayAlerts = False
mySrc.Delete
Application.DisplayAlerts = True
Application.ScreenUpdating = True

End Sub

"Michael168" wrote in message
...
Can someone help for this kind of report?
I have a worksheet range from A1:J3788.
Column 1 contains the date informations.
Column 2 to 9 contains customers name.
How to write each individual customer to a new sheet which contain

only
2 columns

i.e. date and name.

e.g. In master record (Sheet1) contains

29/10/2003 Albert Robert Bobby....etc
30/10/2003 Robert Bobby Albert ....etc.

The sheet name will be auto named after the name of the customer.

So in sheet Albert will be
29/10/2003 Albert
30/10/2003 Albert

In sheet Robert will be
29/10/2003 Robert
30/10/2003 Robert

In sheet Bobby will be
29/10/2003 Bobby
30/10/2003 Bobby

The routine will start from the first row of sheet1 until the last
row.

Thanks you.



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from

http://www.ExcelForum.com/