+ Reply to Thread
Results 1 to 9 of 9

code needed to copy cell data to a newly generated tab

  1. #1
    Registered User
    Join Date
    11-13-2013
    Location
    uk
    MS-Off Ver
    Excel 2010
    Posts
    4

    code needed to copy cell data to a newly generated tab

    Hi,
    I have a spreadsheet that I am using to organize events.
    I have found and running a code that will auto generate a new tab from a template when I enter details into any B cell.
    This works great but what I want to happen is for the new tab (created from template) to also contain the same data that I enter on the master sheet.
    For example:
    I enter 'international meeting' in b3, a new tab is created called 'international meeting' I then enter the location of the meeting in cell c3, then who is hosting the meeting in d3 on the master sheet. I then what the information in c3 and d3 to be copied into the 'international meeting' tab in cells b2 and b3 etc.

    I can work out how to do this using a formula if I knew the name of the new sheet but because it is being auto generated this isnt possible until after and if that is the case I might as well just manually copy the infomation over.

    Could a code be written to do this?

    I am a novice when it comes to excel im afraid.

    Here is the code im running now.

    Please Login or Register  to view this content.
    Thanks guys.
    Last edited by arlu1201; 11-13-2013 at 09:54 AM. Reason: Use code tags in future.

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: code needed to copy cell data to a newly generated tab

    Try this macro. First enter the location and who is hosting the meeting in your "Master" sheet. Then enter the data in B3.
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    11-13-2013
    Location
    uk
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: code needed to copy cell data to a newly generated tab

    Hi Mumps1,
    that works like a dream!
    the only problem that I have is that because its an events diary the rows are set out in months, so I could add an event for April which would mean me entering the the data on rows b18, b19 etc and then one in December which could be on rows b26, b27 etc, so I cannot specify actual columns or rows if that makes sense?
    The new tab generates from any cell within the column 'B' as I set the range from b2:b1000, could the same apply to the code you have just written for me?
    The more I think about it the more impossible I think it is, but hats off to you for this code as it does work how id like it just not exactly.

    Thanks

  4. #4
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: code needed to copy cell data to a newly generated tab

    Could you post a copy of your file with a detailed explanation of what you would like to do?

  5. #5
    Registered User
    Join Date
    11-13-2013
    Location
    uk
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: code needed to copy cell data to a newly generated tab

    Hi,
    What i am wanting to happen is when you enter an event in the B column for the new tab to contain the data that has been filled in in the B, C, D cells to auto fill in the new tabs B1, B2, B3 etc.

    The code you supplied works fine but only fills in when you specify a cell range in the code.
    As I could be entering an event anywhere on the spreadsheet as in is in months I wont know which cells to enter in the code.
    For example if I fill in b3, c3 and d3 on the events tab, a new tab opens named after the data I entered in cell b3. then the new tab has the data in cells b1, b2 and B3 which I entered on the events tab.

    The problem is if I then enter data in cells b16, c16 and d16 the new tab generates but will not copy the data into the b1, b2, b3 because I havent specified the range in the code.

    Hope this makes sense.

    Thanks

    http://snk.to/f-c7kfri8p

  6. #6
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: code needed to copy cell data to a newly generated tab

    Try this code. Because it is a Worksheet_Change event, the macro will be triggered when you enter the event name in column B and then exit the cell. This means that the event name must be the last cell entered. First fill in the venue, then the organisation and finally the event name. If this is awkward, you could put the event name in column D. This would help in entering the event name after the venue and the organisation. If you do this, let me know because the code will have to be changed slightly. As well, I noticed that the organisation is in cell B4 in the template not B3 so I allowed for that. If this is not correct, please let me know.
    Please Login or Register  to view this content.

  7. #7
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: code needed to copy cell data to a newly generated tab

    Perhaps I should have suggested this macro from the beginning. It will work without having to change the order of your columns. The macro is now triggered by entering the Lead Organisation last so that you can enter the data in order.
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    11-13-2013
    Location
    uk
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: code needed to copy cell data to a newly generated tab

    Hi Mumps1,
    That is incredible!both work great. If I need to make any changes im sure I can work them out myself.

    Thanks again

  9. #9
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: code needed to copy cell data to a newly generated tab

    My pleasure.

+ 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. [SOLVED] Formula Needed to copy data from a cell based on data entered into another cell
    By excelteam777 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-10-2013, 03:16 AM
  2. [SOLVED] Copy and paste data into an excel generated cell location
    By BRIANHD in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-24-2013, 02:53 PM
  3. Link macro's to buttons in newly generated file
    By DXP in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-05-2012, 05:08 PM
  4. Copy Data to a Newly Generated Template
    By radar_jynx in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-08-2011, 03:42 AM
  5. Code to scrape system generated outlook email doesn't get all the data
    By bobaftt in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-15-2010, 01:57 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