Closed Thread
Results 1 to 4 of 4

Problem with Macro

  1. #1
    Registered User
    Join Date
    10-01-2009
    Location
    Santa Maria, CA
    MS-Off Ver
    Excel 2003
    Posts
    30

    Problem with Macro

    You guys had previously helped me write a macro which worked at the time. Now when I run the macro, I receive an error: "Run-Time Error '1004': Application-Defined or Object-Defined Error" The following is the macro:

    Sub x()
    Dim r As Range
    Dim cell As Range

    Set r = Worksheets("Data").UsedRange
    With r.Resize(, 1).Offset(, r.Columns.Count)
    .FormulaR1C1 = "=counta(rc12:rc13)*counta(rc15:rc16)"

    For Each cell In .Cells
    If cell.Value Then
    Intersect(cell.EntireRow, r.EntireColumn).Copy _
    Destination:=Worksheets("RF#MTC#Match").Cells(Rows.Count, "A").End(xlUp).Offset(1)
    End If
    Next cell

    .ClearContents
    End With
    End Sub

    If I click "Debug", the line "With r.Resize(,1)....... becomes highlighted in yellow. I don't anything about Basic. I would appreciate any help you can provide.

    Thanks!

  2. #2
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Problem with Macro

    Your post does not comply with the Forum Rules you agreed to follow. All VBA code must be wrapped in code tags. Please amend you post to apply code tags.

    3. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # button at the top of the post window. If you are editing an existing post, press Go Advanced to see the # button. For more information about these and other tags, click here.
    Palmetto

    Do you know . . . ?

    You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.

  3. #3
    Registered User
    Join Date
    10-01-2009
    Location
    Santa Maria, CA
    MS-Off Ver
    Excel 2003
    Posts
    30

    Re: Problem with Macro

    I'm re-posting my macro per Pametto's request.

    Please Login or Register  to view this content.

  4. #4
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Problem with Macro

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.
    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

Closed Thread

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