+ Reply to Thread
Results 1 to 8 of 8

Writing arguments in macro codes

  1. #1
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Brooklyn, NY
    MS-Off Ver
    Office 365
    Posts
    1,172

    Writing arguments in macro codes

    Hello all!

    I am trying to have my code work based off a complicated argument. If it helps understand my issue better my code checks every row of data that falls under the argument and copies the row to a different sheet.
    The rows to be copied must have range A and L populated and range X empty, the tricky part is that the row must also have either range M or O populated in order for the row to get copied, if neither M or O are populated then the code should not copy the row, if both M and O are populated then the row is good to be copied.

    Here is how i wrote the actual code but it's causing my code to bug.

    Please Login or Register  to view this content.
    My code does work fine when i replace the "Or" with an "And".

    Anyway, hope to see responses!
    Thanks in advance

  2. #2
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Writing arguments in macro codes

    Hello kosherboy,

    Try it this way:

    Please Login or Register  to view this content.
    Regards.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  3. #3
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Brooklyn, NY
    MS-Off Ver
    Office 365
    Posts
    1,172

    Re: Writing arguments in macro codes

    Thank you Winon, that seemed to do the trick!

  4. #4
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Writing arguments in macro codes

    Try:
    Please Login or Register  to view this content.
    You missed out the bits I have highlighted in red
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: Writing arguments in macro codes

    Maybe:

    Please Login or Register  to view this content.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  6. #6
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Brooklyn, NY
    MS-Off Ver
    Office 365
    Posts
    1,172

    Re: Writing arguments in macro codes

    Quote Originally Posted by Olly View Post
    Try:
    Please Login or Register  to view this content.
    You missed out the bits I have highlighted in red
    Hi Olly,
    Thanks for responding. Winons reply works fine, are the parenthesis imperative to the code? What would happen if i omit them?

  7. #7
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Writing arguments in macro codes

    You are welcome, kosherboy.

    Glad I could help, and thank for the Rep.

    Regards.

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: Writing arguments in macro codes

    You're welcome. Thanks for the rep.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 4
    Last Post: 06-06-2019, 01:44 AM
  2. Novice with VBA and macro writing needing help to loop a macro unti no data
    By jrongone in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-25-2013, 12:19 PM
  3. Running a macro with arguments from a macro in a different workbook
    By griffolo78 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-29-2012, 04:07 AM
  4. Assign macro to an object with arguments
    By efernandes67 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-15-2011, 07:19 PM
  5. Replies: 1
    Last Post: 07-07-2005, 11:05 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