+ Reply to Thread
Results 1 to 5 of 5

Simple Macro Works for Me but 1004 Error for User

  1. #1
    Forum Contributor
    Join Date
    10-08-2012
    Location
    San Clemente, California
    MS-Off Ver
    Office365
    Posts
    383

    Simple Macro Works for Me but 1004 Error for User

    The macro below simply adds a page break when data changes. It works beautifully on my Windows 8 with Excel365 (it was developed initially in Excel 2010). But a user many miles away gets a 1004 error with his Excel2007 system. I attempted to research 1004 but it seems to be one of those error messages that means different things in different places and I am clueless about what it might mean in this instance.

    Can anybody shed some light on what may be wrong on the user's end?

    Please Login or Register  to view this content.
    Thanks in advance for any suggestions!

  2. #2
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: Simple Macro Works for Me but 1004 Error for User

    Give this a try:

    Please Login or Register  to view this content.
    The lines I had to change were:

    LastRow = Cells(Rows.Count, 2).End(xlUp).Row
    and
    ActiveSheet.HPageBreaks.Add Before:=Cells(x, Col)
    Last edited by Jakobshavn; 06-06-2013 at 08:12 PM.
    Gary's Student

  3. #3
    Forum Contributor
    Join Date
    10-08-2012
    Location
    San Clemente, California
    MS-Off Ver
    Office365
    Posts
    383

    Re: Simple Macro Works for Me but 1004 Error for User

    Hi Jakobshavn,

    Thanks for your input. I will give it to the end user to see if it helps. Would you kindly provide a few words of explanation? What do these changes do that the original code did not?

    Thanks,
    tom

  4. #4
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: Simple Macro Works for Me but 1004 Error for User

    The change to LastRow is necessary because we want to locate the last row, not count the number of rows in UsedRange.
    The change to the HPageBreaks worked on my computer.

  5. #5
    Forum Contributor
    Join Date
    10-08-2012
    Location
    San Clemente, California
    MS-Off Ver
    Office365
    Posts
    383

    Re: Simple Macro Works for Me but 1004 Error for User

    Thanks, Jakobshavn. tom

+ Reply to Thread

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