Results 1 to 3 of 3

loop on Worksheets does not work

Threaded View

  1. #1
    Registered User
    Join Date
    09-19-2013
    Location
    athens
    MS-Off Ver
    Excel 2010
    Posts
    12

    loop on Worksheets does not work

    I'm trying to loop on each sheet of Worksheets to autofill the first empty column of each sheet based on the values of the last used column of each sheet. Looping for some reason does not work. The autofill is performed only for the first sheet of the workbook. Any ideas why? Thanks!

    Here is the code that I use

    Sub test_2013_09_22()
    For Each msh In Worksheets
    	Set SourceRange = Range(Cells(1, msh.UsedRange.Columns.Count), Cells(msh.UsedRange.Rows.Count, msh.UsedRange.Columns.Count))
    	Set fillRange = Range(Cells(1, msh.UsedRange.Columns.Count), Cells(msh.UsedRange.Rows.Count, msh.UsedRange.Columns.Count + 1))
    	SourceRange.AutoFill destination:=fillRange, Type:=xlFillDefault
    Next
    End Sub
    Last edited by runneer; 09-23-2013 at 04:11 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 max value/ match functions to work on multiple worksheets
    By KeithMale in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-04-2013, 07:13 PM
  2. Call Macros before Next loop (loop creates new worksheets)
    By mantooth29 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-24-2012, 05:47 PM
  3. Dim integer in For loop does not work, why?
    By 123wc in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-30-2011, 12:48 PM
  4. Do while loop to delete worksheets if worksheets are not in the specified list
    By kchm_2000 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-26-2011, 03:02 PM
  5. Loop through worksheets within work book
    By kchm_2000 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-11-2011, 06:09 AM

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