LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 519
Default Excel 2007

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Format only part of a DataLabel in Excel 2007/PowerPoint 2007 char SamW Charts and Charting in Excel 6 August 16th 09 08:56 PM
Excel 2007 files not showing on screen when opened in Excel 2007 [email protected] Setting up and Configuration of Excel 1 January 8th 09 05:45 PM
Conflict in excel 2007 with Outlook 2007 attachment excel narnimar Excel Discussion (Misc queries) 0 December 17th 08 02:02 PM
Labels: Unable to import all records Excel 2007 to Word 2007 Mailm skelly Excel Discussion (Misc queries) 1 October 29th 08 11:22 PM
Excel 2007 Macro Help (Excel 2003 not working in 2007) Pman Excel Discussion (Misc queries) 4 May 29th 08 06:29 PM


All times are GMT +1. The time now is 06:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"