Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello from Steved
The below creates "Worksheets" I've got a Header in Row A starting At Col A1 When the below creates the seven worksheets in this case it does not take the heading, please how can I insert in the formula below a formula that will take the heading from the Sheet named Data and insert in the new sheets. Thankyou. Sub UnMatchedTrips() Application.ScreenUpdating = False Dim cell As Range Dim rng As Range, oldSelection As Range Dim wks As Worksheet, wksT As Worksheet Set oldSelection = Selection Set wks = ThisWorkbook.Worksheets("Data") Set rng = Intersect(wks.Columns("A"), wks.UsedRange) For Each cell In rng.Cells If Len(cell.Text) 0 Then Set wksT = GetWorksheet(wks.Parent, "" & Left(cell.Text, 8)) cell.EntireRow.Copy wksT.Columns("A").Cells(cell.Row) End If Next cell On Error Resume Next For Each wksT In wks.Parent.Worksheets wksT.Columns("A").SpecialCells(xlCellTypeBlanks).E ntireRow.Delete xlUp Next Application.Goto oldSelection Application.ScreenUpdating = True End Sub Private Function GetWorksheet(wkbW As Workbook, _ strName As String) As Worksheet Dim wks As Worksheet On Error Resume Next Set wks = wkbW.Worksheets(strName) On Error GoTo 0 If (wks Is Nothing) Then Set wks = wkbW.Worksheets.Add(After:=Worksheets("Data")) wks.Name = strName End If Set GetWorksheet = wks Set wks = Nothing End Function |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Omit header from first page without embedding header in code | Excel Worksheet Functions | |||
Excel-Header-My Company Name won't work in Header (AT&T) & Time | Excel Discussion (Misc queries) | |||
Excel: custom header - is it possible to paste into header? | Excel Worksheet Functions | |||
Sort - Header:=xlGuess vs Header:=xlNo | Excel Programming | |||
how do I permanetly add custom header to excel header list? | Excel Discussion (Misc queries) |