Results 1 to 6 of 6

Loop through sheets error

Threaded View

  1. #1
    Registered User
    Join Date
    10-29-2013
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    4

    Loop through sheets error

    Hi,

    I'm new to VBA and I have a problem with a macro I created. I am trying to loop through all the worksheets in the workbook paste some formulas, do a calculation, take that calculation and place it in a worksheet at the end of the workbook and place the value into the first empty cell in column "A" of the worksheet. The problem is when I run the code I get an error on the destination line:

    Range("IO5").Copy Destination:=Worksheets("Sheet4").Range("A" & Rows.Count).End(xlDown).Offset(1).Select
    What am I doing wrong?

    Here is the complete code:

    Sub INSERT()
    '
    ' INSERT Macro
    '
    
        Dim ws As Worksheet
        For Each ws In ActiveWorkbook.Worksheets
      
        Windows("workbook1.xlsm").Activate
        Range("H1:IW1675").Select
        Selection.Copy
        Windows("workbook2.xlsm").Activate
        Range("H1").Select
        Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
            SkipBlanks:=False, Transpose:=False
            Range("IO5").Copy Destination:=Worksheets("Sheet4").Range("A" & Rows.Count).End(xlDown).Offset(1).Select
            
            ws.Delete
            Next ws
    End Sub
    Thanks
    Last edited by JM5; 12-28-2013 at 01:01 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] loop action through all sheets in workbook skipping certain sheets
    By sawa85sa in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-10-2013, 06:40 PM
  2. Error handling--resume next loop, but for a "DO WHILE" loop
    By submariner18 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-18-2012, 05:35 PM
  3. Want to do a while-loop but get error message: run error '6' overflow
    By danzi in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-07-2011, 01:48 PM
  4. Nesting a loop within a loop error
    By PunPryde in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-17-2011, 08:07 PM
  5. Error '1004', application/object error, Do Loop
    By farzyness in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-25-2011, 12:03 PM

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