Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello from Steved
Where in the code Below to tell it to go Sheet1, Sheet2, and so on as at the moment it Goes Sheet7, Sheet6 and so on. Thankyou Option Explicit Public Sub CopyRowsToSheetN() 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, 11)) 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).EntireRow.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 | |||
change formula in a shared worksheet without losing change history | Excel Worksheet Functions | |||
Excel bar chart formatting of bars to change colors as data change | Excel Discussion (Misc queries) | |||
Use date modified to change format & create filter to track change | Excel Worksheet Functions | |||
change info in other cells when i change a number in a drop list? | Excel Discussion (Misc queries) | |||
Change Cell from Validated List Not Firing Worksheet Change Event | Excel Programming |