+ Reply to Thread
Results 1 to 13 of 13

Macro to copy row

  1. #1
    Registered User
    Join Date
    01-17-2013
    Location
    South Africa
    MS-Off Ver
    Excel 2010
    Posts
    37

    Macro to copy row

    I am looking for a macro that will copy from (Leave availability worksheet) anyone with more(>) than 15 annual_Days Available( column D)
    to the summary worksheet. Please advise if it is possible to have the number of days being searched as a input box i.e if I want to change the
    15 days to lets say 12 depending on what is being searched for.
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    02-09-2012
    Location
    Mauritius
    MS-Off Ver
    Excel 2007
    Posts
    1,055

    Re: Macro to copy row

    Hi.

    Try this macro:

    Leave days.xlsm
    Click *, if my suggestion helps you. Have a good day!!

  3. #3
    Registered User
    Join Date
    01-17-2013
    Location
    South Africa
    MS-Off Ver
    Excel 2010
    Posts
    37

    Re: Macro to copy row

    Thanks for the reply Jraj

    is it possible to copy just first name(A1), Last name(A2) , Full name (A3) and the queried Column (D)?

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

    Re: Macro to copy row

    Hello Luphai,

    Perhaps you would like to try the attached WorkBook with an InputBox, to select what you want?

    Also see the "Please Consider" note at the bottom of this post.
    Attached Files Attached Files
    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] .

  5. #5
    Registered User
    Join Date
    01-17-2013
    Location
    South Africa
    MS-Off Ver
    Excel 2010
    Posts
    37

    Re: Macro to copy row

    Hi Winon

    The macro works perfect is it possible to trim the copied fields to just first name(A1), Last name(A2) , Full name (A3) and the queried Column (D)?

  6. #6
    Valued Forum Contributor
    Join Date
    02-09-2012
    Location
    Mauritius
    MS-Off Ver
    Excel 2007
    Posts
    1,055

    Re: Macro to copy row

    Replace the previous code with this new one:

    Please Login or Register  to view this content.
    If solved please click the star below. Thanks.

  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: Macro to copy row

    Don't you actually mean; "is it possible to trim the copied fields to just first name(A1), Last name(B1) , Full name (C1) and the queried Column (D)?

    The Code should just do that.

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

    Re: Macro to copy row

    O.K. Try this WorkBook
    Attached Files Attached Files

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

    Re: Macro to copy row

    Hello Luphai,

    I have applied a different approach, and I am certain the revised attached WorkBook solves your issue.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    01-17-2013
    Location
    South Africa
    MS-Off Ver
    Excel 2010
    Posts
    37

    Re: Macro to copy row

    Hi Winon can we make >= to Lsearch value as when I add the > operator it does not seem to work
    check code attached.

    Please Login or Register  to view this content.

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

    Re: Macro to copy row

    No, that wont work.

    I don't understand why you would want to do that, since the Value of the LSearchRow is derived from the exact Value entered in the InputBox, and cannot be less or greater than just that Value entered.

    Try to enter any value not available in Column D of the Leave availability Sheet, and see what happens.

  12. #12
    Registered User
    Join Date
    01-17-2013
    Location
    South Africa
    MS-Off Ver
    Excel 2010
    Posts
    37

    Re: Macro to copy row

    Hi the reason is if anyone has more than lets say 9 days of leave available then HR
    will advice or force them to take leave. Therefore the Lsearch value is the minimum days
    you should have and the 9 days and above employees will be in violation.

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

    Re: Macro to copy row

    9 days and above employees will be in violation
    Will the attached work for you then?
    Attached Files Attached Files

+ Reply to 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