+ Reply to Thread
Results 1 to 9 of 9

I need to copy information from one workbook to another workbook using a search function

  1. #1
    Registered User
    Join Date
    02-08-2013
    Location
    Nottingham
    MS-Off Ver
    Excel 2010
    Posts
    6

    Red face I need to copy information from one workbook to another workbook using a search function

    Hi

    First post here gos. I am looking to transfer information from one colomn in one workbook to another cell range i choose in another workbook. But the information from the first workbook needs to be seached through.

    i.e. i need all instances of Oranges to be found and transferred to the other workbook within a cell range of my choice and so on.

    Can this be done. I have been trying Vlookup and several other formulas to no avail.

    Hope some one can help

    Many thanks

  2. #2
    Registered User
    Join Date
    01-30-2013
    Location
    Kansas
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: I need to copy information from one workbook to another workbook using a search functi

    frow = Application.WorksheetFunction.Match(Target, Range("YOUR RANGE"), 0)

    Hope it helps.

  3. #3
    Registered User
    Join Date
    02-08-2013
    Location
    Nottingham
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: I need to copy information from one workbook to another workbook using a search functi

    Hi thank you for the quick response I will try it and get back to you

  4. #4
    Registered User
    Join Date
    02-08-2013
    Location
    Nottingham
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: I need to copy information from one workbook to another workbook using a search functi

    Hi so say the first workbook that holds the seachable info is called Exp and the second workbook is called Job and the word i want to search is oranges. How would the formula look. Sorry if im being a biff i just cant work it out.

    frow = Application.WorksheetFunction.Match(Target, Range("YOUR RANGE"), 0) work?

  5. #5
    Registered User
    Join Date
    02-08-2013
    Location
    Nottingham
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: I need to copy information from one workbook to another workbook using a search functi

    Hi so say the first workbook that holds the seachable info is called Exp and the second workbook is called Job and the word i want to search is oranges. How would the formula look. Sorry if im being a biff i just cant work it out.

    frow = Application.WorksheetFunction.Match(Target, Range("YOUR RANGE"), 0) work?

  6. #6
    Registered User
    Join Date
    01-30-2013
    Location
    Kansas
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: I need to copy information from one workbook to another workbook using a search functi

    Target = Oranges

    Sheets("EXP").Select
    frow = Application.WorksheetFunction.Match(Target, Range("a1:a100"), 0)
    ' If a1-a100 is the column you're searching through, you could do a1:g100
    ' If you wanted to....

    But I just reread and you need every instance... So that will not work. Sorry.
    I think MATCH only finds the 1st instance using a binary search algo.
    I would say you should run a loop through the column and use the instr function. But that could take some time.
    As to the fastest cleanest way to do this I'm not exactly sure.
    If I have assisted you, please add to my Rep

  7. #7
    Registered User
    Join Date
    02-08-2013
    Location
    Nottingham
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: I need to copy information from one workbook to another workbook using a search functi

    Thank you for your help so grateful, but like you said I do need all instances. Hope some one can help otherwise back to the drawing board

  8. #8
    Registered User
    Join Date
    01-30-2013
    Location
    Kansas
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: I need to copy information from one workbook to another workbook using a search functi

    Usually people on here are pretty good, I'm sure one of the Guru Users know a quick way to do this.

    The guy here has a way to find every instance, edit that to do what you want instead of change color maybe?:

    http://www.excelforum.com/excel-prog...using-vba.html
    Last edited by ExcelWizards; 02-15-2013 at 05:41 PM. Reason: Useful Info

  9. #9
    Registered User
    Join Date
    02-08-2013
    Location
    Nottingham
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: I need to copy information from one workbook to another workbook using a search functi

    I have tried this and tweeked the range i want which finds all instances. But I cannot get the info from one work book to another to cells i specify. I just dont have the knowledge. Can anybody help

    Sub boldme()

    With Sheets("Sheet2").Range("E1:E" & Rows.Count)

    Dim MyVal, vFIND As Range, vFIRST As Range

    MyVal = Array("BLADES")

    On Error Resume Next

    For i = 0 To UBound(MyVal)

    Set vFIND = .Find(What:=MyVal(i), lookat:=xlPart, MatchCase:=False, SearchFormat:=False)

    If Not vFIND Is Nothing Then
    Set vFIRST = vFIND
    Do
    For j = -4 To 6
    vFIND.Offset(0, j).Interior.Color = vbRed
    vFIND.Offset(0, j).Font.Bold = True
    Next j
    Set vFIND = .FindNext(vFIND)
    Loop While vFIND.Address <> vFIRST.Address


    End If
    Next i

    MyVal = Array("GENDLE")

    On Error Resume Next

    For i = 0 To UBound(MyVal)

    Set vFIND = .Find(What:=MyVal(i), lookat:=xlPart, MatchCase:=False, SearchFormat:=False)

    If Not vFIND Is Nothing Then
    Set vFIRST = vFIND
    Do
    For j = -4 To 6
    vFIND.Offset(0, j).Interior.Color = vbBlue
    vFIND.Offset(0, j).Font.Bold = True
    Next j
    Set vFIND = .FindNext(vFIND)
    Loop While vFIND.Address <> vFIRST.Address

    End If
    Next i

    MyVal = Array("STEEL")

    On Error Resume Next

    For i = 0 To UBound(MyVal)

    Set vFIND = .Find(What:=MyVal(i), lookat:=xlPart, MatchCase:=False, SearchFormat:=False)

    If Not vFIND Is Nothing Then
    Set vFIRST = vFIND
    Do
    For j = -4 To 6
    vFIND.Offset(0, j).Interior.Color = vbYellow
    vFIND.Offset(0, j).Font.Bold = True
    Next j
    Set vFIND = .FindNext(vFIND)
    Loop While vFIND.Address <> vFIRST.Address

    End If
    Next i
    End With
    Set vFIRST = Nothing
    Set vFIND = Nothing
    End Sub

+ 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

X vBulletin 4.1.8 Debug Information

  • Page Generation 0.06766 seconds
  • Memory Usage 9,022KB
  • Queries Executed 14 (?)
More Information
Template Usage (31):
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (1)footer
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (9)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (4)navbar_noticebit
  • (6)option
  • (9)postbit_legacy
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (4)showthread_bookmarksite
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper
  • (1)vbseo_linkbackmenu_entry 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (39):
  • ./vbseo.php
  • ./env.php
  • ./vbseo/includes/functions_vbseo.php
  • ./vbseo/includes/functions_vbseo_pre.php
  • ./vbseo/includes/functions_vbseo_url.php
  • ./vbseo/includes/functions_vbseo_createurl.php
  • ./vbseo/includes/functions_vbseo_db.php
  • ./vbseo/includes/functions_vbseo_vb.php
  • ./vbseo/includes/functions_vbseo_seo.php
  • ./vbseo/includes/functions_vbseo_misc.php
  • ./vbseo/includes/functions_vbseo_crr.php
  • ./vbseo/includes/functions_vbseo_cache.php
  • ./vbseo/includes/functions_vbseo_hook.php
  • ./vbseo/includes/functions_vbseo_startup.php
  • ./includes/config.php
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/functions.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/functions_cforum.php
  • ./includes/functions_facebook.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (46):
  • init_startup
  • friendlyurl_resolve_class
  • database_pre_fetch_array
  • database_post_fetch_array
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • fetch_musername
  • cache_templates
  • template_register_var
  • parse_templates
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • reputation_image
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit_complete
  • forumrules
  • showthread_bookmarkbit
  • navbits
  • navbits_complete
  • showthread_complete


Search Engine Friendly URLs by vBSEO 3.6.0 RC 1