+ Reply to Thread
Results 1 to 8 of 8

Copy grouped cells based on typing a word in another cell

Hybrid View

  1. #1
    Registered User
    Join Date
    06-02-2015
    Location
    Buford, GA
    MS-Off Ver
    Office 2010
    Posts
    4

    Copy grouped cells based on typing a word in another cell

    I am trying to copy a group of cells that is another tab by simple typing a word "New". For example, my grouped cells is called 'Project' that is located on the tab called 'Data'. On my tab that is called 'Project List' I would like to type the word "New" (for example in cell 'A1' and have it copy the group of cells exactly how it is on the tab 'Data'...

    Once I get that part done I have another part of this that I will need help on...one thing at a time or my head will implode. Engineering Project List.xlsx

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Copy grouped cells based on typing a word in another cell

    Hi JJ,

    Welcome to the Forum!

    Here's an event procedure for your Project List sheet:

    Private Sub Worksheet_Change(ByVal Target As Range)
    Application.EnableEvents = False
    If Target = "New" And Target.Address = "$A$1" Then
    Sheets("Data").UsedRange.Offset(1).Copy Range("A2")
    Else: UsedRange.Clear
    End If: Application.EnableEvents = True: End Sub
    Directions for running the routine(s) just supplied

    If you haven't used macros before you'll need to go to:
    File- options - trust center -trust center settings - macro settings ,
    the second option down (disable all macros with notification)

    Then - Copy the code to the clipboard

    Open your Workbook

    Press ALT + F11 to open the Visual Basic Editor.

    Click on the sheet

    Type "Option Explicit" then paste the code under it

    Save the workbook as Macro-Enabled and you're ready to go
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    06-02-2015
    Location
    Buford, GA
    MS-Off Ver
    Office 2010
    Posts
    4

    Re: Copy grouped cells based on typing a word in another cell

    First off thank you for your help and I am one of those Excel users that does not get too far into the VBA stuff. I did some things in the past, but my memory always gets it wrong when I try it some years down the road. I guess I just need to do it more?

    Okay so that sort of worked, couple of things on this. I don't won't to copy everything on the "Data" sheet. I only want it to copy cells A55 through J56, which I have grouped as "Project" in the name window. Also, if it is possible I would like for when it is copy to overwrite the word "new". In other words wherever I type the word "New" is where it will start the paste.

  4. #4
    Registered User
    Join Date
    06-02-2015
    Location
    Buford, GA
    MS-Off Ver
    Office 2010
    Posts
    4

    Re: Copy grouped cells based on typing a word in another cell

    Okay I am going at this all wrong and need to simplify this for the end user.

    So with that, here is the scenario, User types in a “named” value in any of the cells on the tab labeled “Project List”. These “named” values are listed as “Oven”, “Oven_Comp”, “Comp”, “Heater”, “GPS”, and “Controls” and are in the tab listed as “Data”. When user types any one of these names in a cell located on the “Project List” tab it will copy that named group cells exactly as it formatted in the tab “Data”

    For example, we are working on a some new projects in engineering let’s two. An Oven project, and a Heater project. Starting with the first one, the user types in “A1” on the “Project List” tab “Oven”. Excel will copy all of the named group cells called “Oven” that is located in the “Data” tab and paste it, starting with “A1” in the “Project List” tab (overwriting the word that was just typed and resetting the macro). After that is done he may skip down A16 on the “Project List” and type “Heater”. Again, Excel will copy all of the grouped cells called “Heater”, once again overwriting the word he just typed in that cell. This can keep going, on and on.

    If for some reason the user did not mean for that typed word after he hit enter he should be able to undo it by clicking undo or ctrl-Z or at least selecting it and deleting it.

    Does any of this make since? I have attached an updated spread sheet so you can see my layout.
    Attached Files Attached Files

  5. #5
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Copy grouped cells based on typing a word in another cell

    Hi JJ,

    The Forum was impacted by the flawed security app that they've (recently?) installed - I'll see what I can do tomorrow.

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Copy grouped cells based on typing a word in another cell

    Hi JJ,

    Try this and let me know:Engineering Project ListJJ.xlsm

  7. #7
    Registered User
    Join Date
    06-02-2015
    Location
    Buford, GA
    MS-Off Ver
    Office 2010
    Posts
    4

    Re: Copy grouped cells based on typing a word in another cell

    Hey this is it! Thanks a lot!

    One issue though, it only allows it to do once for each type. It could be that I am working on more than one of same type. Is there a way to add line of code so it can just repeat this routine over and over again?
    Last edited by 2Js; 06-05-2015 at 08:25 AM.

  8. #8
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Copy grouped cells based on typing a word in another cell

    Hi JJ,

    Thanks for the rep!


    Sub JJAdams(T As Range): Dim wd As Worksheet, Names, N As Long, F As Range
    Names = Array("Oven", "Oven_Comp", "Comp", "Heater", "GPS", "Controls")
    For N = LBound(Names) To UBound(Names)
    If T.Value = Names(N) Then GoTo Proceed
    Next N: Exit Sub
    Proceed:
    Application.EnableEvents = False: T = ""
    Set wd = Sheets("Data"): wd.Range(Names(N)).Copy T
    Application.EnableEvents = True
    End Sub

+ 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. Copy certain cell data based on word
    By twisted31 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-03-2013, 05:56 PM
  2. [SOLVED] Copy specific cells based on one word in the cell, to a different worksheet
    By Lfaulst1 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-30-2013, 05:26 PM
  3. copy rows including the grouped cells from another worksheet
    By darkhangelsk in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-14-2012, 04:33 AM
  4. Replies: 3
    Last Post: 11-09-2011, 12:05 PM
  5. Copy and paste in other cells while typing in different cells
    By go4cdt in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-11-2009, 02:50 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