+ Reply to Thread
Results 1 to 12 of 12

Adding a searchbox and exporting data from a row to a new template (have existing code)

  1. #1
    Forum Contributor
    Join Date
    10-04-2010
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    455

    Adding a searchbox and exporting data from a row to a new template (have existing code)

    Hi All,

    I was fortunate enough to receive some excellent code (below) from this forum recently which exports project data from a "project register" file to a template file.

    Each row in the project register constitutes a project with a unique project reference number found in column "L" e.g. PS00015.

    If there are 50 rows in the project register 50 templates would be populated and saved down. At the momement this macro exports ALL projects within the file.

    I've now been asked to add an option to only export 1 project at a time by means of an input box by inserting the project reference number i.e. if i choose project PS00015 only 1 template will be populated with its data.

    The below code have some non relevant sections removed to keep it short.

    Please Login or Register  to view this content.
    Last edited by Gti182; 08-08-2013 at 11:23 AM.

  2. #2
    Forum Contributor
    Join Date
    10-04-2010
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    455

    Re: Adding a searchbox and exporting data from a row to a new template (have existing code

    anybody?

  3. #3
    Forum Contributor
    Join Date
    06-22-2011
    Location
    somerset
    MS-Off Ver
    365
    Posts
    328

    Re: Adding a searchbox and exporting data from a row to a new template (have existing code

    need more detail. there are a lot of undefined variables and a test sheet would be usefull. without that it is really hard to do test runs and de-bugs on any solution.

    you can try this as a guess
    Please Login or Register  to view this content.
    Last edited by Leon V (AW); 08-08-2013 at 09:44 AM.

  4. #4
    Forum Contributor
    Join Date
    10-04-2010
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    455

    Re: Adding a searchbox and exporting data from a row to a new template (have existing code

    Ok will work on a quick example and load it up

  5. #5
    Forum Contributor
    Join Date
    10-04-2010
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    455

    Re: Adding a searchbox and exporting data from a row to a new template (have existing code

    uploaded the two files, sorry should have thought about that sooner.

    This is the actual layout of the files i'm using, only data values have been removed or modified.
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    10-04-2010
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    455

    Re: Adding a searchbox and exporting data from a row to a new template (have existing code

    Thanks Leon, your code works perfectly although noticed had to remove the "Set" from the below code for it to work.

    Please Login or Register  to view this content.
    changed to
    Please Login or Register  to view this content.
    I also noticed if you type in an incorrect number it gives a debug error, is there a bit of code i can use to stop the macro if this is done and maybe give an error message "number not found"?

    Gave you some reputation kudos

  7. #7
    Forum Contributor
    Join Date
    06-22-2011
    Location
    somerset
    MS-Off Ver
    365
    Posts
    328

    Re: Adding a searchbox and exporting data from a row to a new template (have existing code

    how about this?
    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    10-04-2010
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    455

    Re: Adding a searchbox and exporting data from a row to a new template (have existing code

    getting a compile error type mismatch on this part

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    06-22-2011
    Location
    somerset
    MS-Off Ver
    365
    Posts
    328

    Re: Adding a searchbox and exporting data from a row to a new template (have existing code

    change it to
    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    10-04-2010
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    455

    Re: Adding a searchbox and exporting data from a row to a new template (have existing code

    ah that fixed the compile error but it isn't really doing what i want it to now

    When i put a wrong number in still gives a runtime error 91 and if i put nothing in and click ok it exports all the project files? Does your bit of code work in the test files I attached?

  11. #11
    Forum Contributor
    Join Date
    06-22-2011
    Location
    somerset
    MS-Off Ver
    365
    Posts
    328

    Re: Adding a searchbox and exporting data from a row to a new template (have existing code

    I can't download test files (Secure Site) am trying to do this blind.
    it was my fault made BG the row property of a range which screws up when you fail to find a range.
    Please Login or Register  to view this content.

  12. #12
    Forum Contributor
    Join Date
    10-04-2010
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    455

    Re: Adding a searchbox and exporting data from a row to a new template (have existing code

    that now works great didn't realise you were doing it blind, that's really impressive!

    Thanks so much Leon!

+ 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: 2
    Last Post: 03-17-2011, 08:55 PM
  2. Help adding to existing code
    By Jrykiss in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 12-02-2010, 06:11 PM
  3. Adding Code to an Existing UserForm with VBA
    By JimmyA in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-08-2010, 12:02 PM
  4. Replies: 1
    Last Post: 08-15-2009, 05:52 AM
  5. adding to an existing line of VBA code
    By Gazzr in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-08-2007, 08:37 PM

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