Results 1 to 7 of 7

Loop until won't stop!?

Threaded View

  1. #1
    Registered User
    Join Date
    06-19-2007
    Posts
    47

    Loop until won't stop!?

    I've fixed my previous problem, and this formula works except for one thing!

    it doesnt stop at the last empty cell it continues to create a new sheet but is unable to name it as ther is nothing in the cell from whihc it takes its name.

    why? what have i missed?

    thanks
     Sub Macro1()
    '
    ' Macro1 Macro
    ' Macro recorded 26/07/2007 by Michael Skinner
    '
    Application.ScreenUpdating = False
    Sheets("export").Select
    Range("Ar2").Select
    
    Do Until IsEmpty(ActiveCell)
    
    For n = 1 To 100
    Dim sSheetName As String
    sSheetName = (ActiveCell)
    
        Sheets("Template").Select
        Sheets("Template").Copy After:=Sheets(1)
        
        Sheets("Template (2)").Select
        Sheets("Template (2)").Name = sSheetName
        
        Sheets("export").Select
        Range("A1").Select
        ActiveCell.Offset(n, 0).Select
        Application.CutCopyMode = False
        Selection.Copy
        Sheets(sSheetName).Select
        Range("E2:AA2").Select
        ActiveSheet.Paste
        
       
        Sheets("export").Select
        Range("b1").Select
        ActiveCell.Offset(n, 0).Select
        Application.CutCopyMode = False
        Selection.Copy
        Sheets(sSheetName).Select
        Range("h10").Select
        ActiveSheet.Paste
        
        Sheets("export").Select
        Range("c1").Select
        ActiveCell.Offset(n, 0).Select
        Application.CutCopyMode = False
        Selection.Copy
        Sheets(sSheetName).Select
        Range("H11").Select
        ActiveSheet.Paste
        
        Sheets("export").Select
        Range("d1").Select
        ActiveCell.Offset(n, 0).Select
        Application.CutCopyMode = False
        Selection.Copy
        Sheets(sSheetName).Select
        Range("E6").Select
        ActiveSheet.Paste
    
        Sheets("export").Select
        Range("at1").Select
        ActiveCell.Offset(n, 0).Select
        Application.CutCopyMode = False
        Selection.Copy
        Sheets(sSheetName).Select
        Range("e38").Select
        ActiveSheet.Paste
        
    Sheets("export").Select
    Range("Ar2").Select
    ActiveCell.Offset(n, 0).Select
    
    Next n
    
          
    Loop
    End Sub
    Last edited by VBA Noob; 07-26-2007 at 02:17 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1