+ Reply to Thread
Results 1 to 5 of 5

MACRO Transfer entire row based on a table in a third sheet/tab

  1. #1
    Registered User
    Join Date
    06-11-2010
    Location
    Manila
    MS-Off Ver
    Excel 2007
    Posts
    29

    MACRO Transfer entire row based on a table in a third sheet/tab

    Hi guys,

    Hope all is well with everybody!

    Need help -

    I have three sheets (please see attachment)

    Basically, I would like to transfer NON US under the Dom tab to Intl. And I've already handled that using

    Please Login or Register  to view this content.
    My problem is those in Canada, for instance the Toronto, ON. As stated in my code, I base my transferrance on the State Column (Column B) And since Toronto, ON is <> 0 so it stays.

    I made the US State Abbrev tab to try to make use of vlookup, find, etc but I have no idea how to use them in Macro. I tried but never did succeeded. Evidently.

    Any help is very valuable. I'm looOosing me mind reading people's codes. (_ _!!!)


    Thanks guys (in advance)

    More power!

    Kat

    Oh and by the way, I am also open to a solution whereas States are vlookup/find in my third sheet (US State Abbrev). But any help will do

    Thanks again!
    Attached Files Attached Files
    Last edited by eastydie; 03-31-2011 at 04:59 AM. Reason: reset replies to zero

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: MACRO Transfer entire row based on a table in a third sheet/tab

    eastydie,

    I put in a formula in Column C of the Dom sheet
    Formula: =IF(COUNTIF('US State Abbrev'!$B$2:$B$51,Dom!B2)>0,"US","Non-US")

    The formula checks if the State Abbrviation exists in the table. If so, it populates the cell with "US" otherwise it populates the cell with "Non-US"

    Using column C, I created a macro to move all Non-US items to the Intl sheet:

    Please Login or Register  to view this content.

    I've attached a modified version of your excel file that contains the changes

    Hope that helps,
    ~tigeravatar
    Attached Files Attached Files
    Last edited by tigeravatar; 03-29-2011 at 12:47 PM. Reason: Removed unnecessary line from the code: Dim IntlSearch As Range: SetIntlSearch = Sheets("Dom").Range("C2:C" & lastitem)

  3. #3
    Registered User
    Join Date
    06-11-2010
    Location
    Manila
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: MACRO Transfer entire row based on a table in a third sheet/tab

    Hi tigeravatar, thanks! that's an idea that didn't occur to me! thank you so much!
    Anyhoo, would it be possible not to have additional columns? And by the way, I plan to hide the US Abbrev sheet so as not to clutter my worksheet; can Macro still call these hidden tab/sheet, right ?

  4. #4
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: MACRO Transfer entire row based on a table in a third sheet/tab

    eastydie,

    The macro copies the entire row, so you could have as many columns as you wanted. And yes, the macro should have no trouble working with data in hidden sheets, or hidden sections of sheets

    ~tigeravatar

  5. #5
    Registered User
    Join Date
    06-11-2010
    Location
    Manila
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: MACRO Transfer entire row based on a table in a third sheet/tab

    hi again tigeravatar, my original formula also took the entire row. My sort-of problem is the negligence to populate additional columns.

    But nevertheless, I took your advice. I also added a code on yours that will automatically populate the column with the formula. I don't know if it is a forum-rule compliant to paste it here just for sharing, but here goes:

    Please Login or Register  to view this content.
    thanks tigeravatar! It's been a blast!

+ 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