Results 1 to 7 of 7

Code not working!

Threaded View

suivanova Code not working! 05-23-2012, 10:30 AM
RaulRodriguez Re: Can someone tell me why... 05-23-2012, 10:34 AM
RaulRodriguez Re: Can someone tell me why... 05-23-2012, 10:42 AM
suivanova Re: Can someone tell me why... 05-23-2012, 12:13 PM
RaulRodriguez Re: Code not working! 05-23-2012, 01:02 PM
tigeravatar Re: Code not working! 05-23-2012, 01:11 PM
suivanova Re: Code not working! 05-23-2012, 01:46 PM
  1. #1
    Registered User
    Join Date
    05-23-2012
    Location
    Washington, DC
    MS-Off Ver
    Excel 2010
    Posts
    3

    Code not working!

    I created the following macro that will cut and paste info in every sheet of a workbook into the first one.
    Sub CutNPasteSheets()
    '
    ' This macro selects from worksheet 2 to the end-1 columns A to I and cut and paste the content
    ' to the first sheet of the workbook
    
        Dim I As Integer
        Dim mysheets As Integer
        
        mysheets = Sheets.Count
            
        
      For I = 2 To I = mysheets - 1
        
        Sheets(I).Select
        Range("A1:I1").Select
        Range(Selection, Selection.End(xlDown)).Select
        Selection.Cut
        
        Sheets(1).Activate
        ActiveCell.Range("A1").Select
        Selection.End(xlDown).Select
        ActiveCell.Offset(1, 0).Range("A1").Select
           
        
        ActiveSheet.Paste
        Selection.End(xlDown).Select
        
      Next I
    
    End Sub
    I used Ctrl F8 to follow through to find out what it does nothing! and I still don't understand what I am doing wrong. It goes well until the loop start, then nothing happens.

    Please help
    Last edited by arlu1201; 05-23-2012 at 12:35 PM. Reason: Use code tags in future.

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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