Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello from Steved
The below Macro's objective is to copy then paste into prenamed worksheets For example it is a sheet1 called Data, in Col A it has 1-City I've named Sheet2 as 1-City, I am asking that it copies the Values in Col A to Col E that has 1-City in Col A to the named Sheet "!-City" and paste in Col A2 As I've given Col A1 a Heading, Ive named the other Sheets 2-Rosk, 4-Wiri, 5-Shor, 6-Orew, 7-Swan, 8-Panm all getting the Values from The sheet Named Data. Yes Copy values From Sheet Called Data to the other named sheets as Labeled above. Below is giving me out of script range. Please What is required for it to work. ps no if you have a better way off Acieving a result please show me Thankyou. Ok simply put, Look in Sheet Called Data, copy Values and put in appropriate paste into Sheets. Sub AnulToDepots() Dim cLastRow As Long Dim i As Long Dim iStartRow As Long Dim iLastRow As Long With Worksheets("Data") cLastRow = .Cells(.Rows.Count, "A").End(xlUp).Row iStartRow = 1 iLastRow = 1 For i = 3 To cLastRow + 1 If .Cells(i, "A").Value < Cells(i - _ 1, "A").Value Then iLastRow = i - 1 .Cells(1, "A").EntireRow.Copy _ Destination:=Worksheets(.Cells(i - _ 1, "A").Value).Range("A1") .Cells(iStartRow, "A").Resize(iLastRow - _ iStartRow + 1).EntireRow.Copy _ Destination:=Worksheets(.Cells(i - _ 1, "A").Value).Range("A1") iStartRow = i iLastRow = i Else iLastRow = iLastRow + 1 End If Next i End With End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Format only part of a DataLabel in Excel 2007/PowerPoint 2007 char | Charts and Charting in Excel | |||
Excel 2007 files not showing on screen when opened in Excel 2007 | Setting up and Configuration of Excel | |||
Conflict in excel 2007 with Outlook 2007 attachment excel | Excel Discussion (Misc queries) | |||
Labels: Unable to import all records Excel 2007 to Word 2007 Mailm | Excel Discussion (Misc queries) | |||
Excel 2007 Macro Help (Excel 2003 not working in 2007) | Excel Discussion (Misc queries) |