microsoft-excel-courses - loop through list copying
Microsoft Office Training verified by visa - mastercard securecode about microsoft training company london ukadd this page to your favourites/bookmarksAdd to favourites
view a printable version of this pagePrintable version
email this page to somebodyEmail this page
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft Excel Training and help » microsoft-excel-courses - Loop through a list copying each item on the list to a new works

microsoft-excel-courses - Loop through a list copying each item on the list to a new works

The UK's most regular instructor-led training courses.
Training information: microsoft-excel-courses · Microsoft+excel+training · Microsoft Excel Training
See also · excel-courses-london · excel courses in london · excel microsoft training

resolvedResolved · Low Priority · Version Standard

Loop through a list copying each item on the list to a new works

Alistair has attended:
Excel Advanced course

by - delegate Alistair [19 posts] (2007 Apr 3 Tue, 17:30) replyReply

Hi,

Please let me know how I can loop through a list copying each list item to its own individual worksheet.

I have tried using this the below formula to locate the last row, then tried to cycle through the list from cell A1 to cell A"row" copying each to cell value to its own spreadsheet. Even without the below (say just going from 1 to 5) it doesn't work.

Please, please, please help. I can't even get Excel to recognise what I mean by Cell A "row", or even copying and pasting which should be fairly simple.

Cheers
ALi.

Public Sub LastCellsWithData()
' ExcelLastCell is what Excel thinks is the last cell
Set ExcelLastCell = ActiveSheet.Cells.SpecialCells(xlLastCell)

' Determine the last row with data in it (must also copy above para for this to work)
LastRowWithData = ExcelLastCell.Row
Row = ExcelLastCell.Row
Do While Application.CountA(ActiveSheet.Rows(Row)) = 0 And Row <> 1
Row = Row - 1
Loop
LastRowWithData = Row' Row number

Excel VBA 2 day course
Version Date Location Places
available
Book Next place rate:
Card Invoice
2003 2008 Dec 4 Thu + 5 Fri Bloomsbury 3 book now £475 £495
2007 2008 Dec 11 Thu + 12 Fri Bayswater 4 book now £499 £530
2007 2009 Jan 8 Thu + 9 Fri Bloomsbury 8 book now £345 £425
2003 2009 Jan 22 Thu + 23 Fri Southwark 4 book now £475 £485
2003 2009 Jan 29 Thu + 30 Fri Bayswater 6 book now £450 £485
2007 2009 Feb 5 Thu + 6 Fri Bloomsbury 7 book now £450 £475
Full Schedule: See all 34 Excel VBA course dates.
Bookings currently available until 26th November 2009.

RE: Loop through a list copying each item on the list to a new w

by - delegate Alistair [19 posts] (2007 Apr 3 Tue, 17:33) replyReply

Something along these lines is what I want to do. (this isn't copying to a new sheet but one step at a time eh!)

Sub Macro9()

Number = 1
Do
Range("A,Number").Select
Selection.Copy
Range("C,Number").Select
ActiveSheet.Paste
Number = Number + 1
Loop Until Number = 5

End Sub

RE: Loop through a list copying each item on the list to a new w

by - trainer Carlos gold contributer[479 posts] (2007 Apr 22 Sun, 22:41) replyReply

Alistair

Your error is trying to use a variable in a string. "A,Number" is telling the computer to find a row called "number" and not 1.

When using variables you need to use Cells(Row, Column) instead of Range.

To get your loop to work

Number = 1

Do

Cells(Number, 1).Select 'Where 1 is the column "A" and Number the Row
Selection.Copy

Cells(Number, 3).Select 'Where 3 is the column "C"
Selection.Copy
ActiveSheet.Paste

Number = Number + 1
Loop Until Number = 5

To copy to a new sheet You need a counter for the new sheet rows and a line selecting the new sheet.


Regards

Carlos


Related articles

· Tools From Advanced Excel Courses: Goal Seek and Solver
· Creating Charts with Excel
· Why Should I Learn Visual Basic in Excel?
· Fun Things I've Done With Excel
· 3 Reasons why Your Small Business Office Needs Microsoft Excel Training

Excel tip:

Selecting blank cells within a range of data

Select the range of data which includes the blank cells that you would like to select. Press the F5 key, this will take you to the GoTo dialogue box where you can click on Special and then select Blanks.

View all Excel hints and tips

Rate this page:
4.0/5 (3 votes cast)
Institute of IT Training - Accredited Training Provider Microsoft Certified Partner
microsoft office
Microsoft Office Specialist Authorised Testing Centre (MOS and MCAS)

Prodigy Platinum Learning Partner

Institute of IT Training - Accredited Training Provider Association of Computer Trainers Valid HTML 4.01 Transitional
Valid CSS Markup

secure online payments - visa - mastercard

Mini sitemap. These are the main areas of our web site. Full sitemap.

Training by application Main information pages See also

Access courses
DreamWeaver courses
Excel courses
MS Project courses
Outlook courses
PowerPoint courses
VBA courses
Word courses
(more...)

Public scheduled courses
On-site training
Closed company courses

Microsoft Office training
Pricing and availability
Training schedule
Training venues

Access training
Dreamweaver training
Excel training
MS Project training
PowerPoint training

London Computer Training
Computer Training London

Microsoft Access training
Microsoft Excel training
Microsoft Project training
Microsoft Outlook training
Microsoft Powerpoint training
Microsoft Word training

Time Management Course London

Interested in Access training? Please see the following pages:
microsoft access courses · microsoft training access course
microsoft+access+training · access courses in london

Training Information

Training Articles

AddThis Social Bookmark Button What's this?
Add to Del.icio.us Add to Facebook Add to Digg Add to Reddit Add to Google Add to Yahoo Add to Diigo Add to Mr. Wong Add to Linkarena Add to Power Oldie Add to Folkd Add to Jumptags Add to Upchuckr Add to Simpy Add to StumbleUpon Add to Slashdot Add to Netscape Add to Furl Add to Spurl Add to Blinklist Add to Blogmarks Add to Technorati Add to Newsvine Add to Blinkbits Add to Ma.Gnolia Add to Smarking Add to Netvouz