+ Reply to Thread
Results 1 to 7 of 7

Macro to fill 3 columns in one sheet with data from 3 cells in another sheet

  1. #1
    Registered User
    Join Date
    07-08-2013
    Location
    Boston
    MS-Off Ver
    Excel 2010
    Posts
    11

    Macro to fill 3 columns in one sheet with data from 3 cells in another sheet

    I have a "Start" sheet that the user adds a 6 digit ID in B:2, selects a username from a dropdown in B:3. B4 has today's date.

    I need to copy the ID, Name and Date to Sheet "Complete" into Column B(ID), C(Name) and D(Date) where column A(Comment) will have unknown # of rows.

    Start Sheet:

    ID 999999
    Name Doe, John
    Date 11/29/13

    Complete Sheet:

    Comment ID Name Date
    Test1 999999 Doe, John 11/29/13
    Test2 999999 Doe, John 11/29/13
    Test3 999999 Doe, John 11/29/13
    Test4 999999 Doe, John 11/29/13
    Test5 999999 Doe, John 11/29/13

    Thanks in advance!

  2. #2
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,412

    Re: Macro to fill 3 columns in one sheet with data from 3 cells in another sheet

    Hi,
    You don't say where in the Complete Sheet the data must be copied, so I assumed it was B2.

    Please Login or Register  to view this content.
    GC Excel

    If this post helps, then click the star icon (*) in the bottom left-hand corner of my post to Add reputation.

  3. #3
    Registered User
    Join Date
    07-08-2013
    Location
    Boston
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Macro to fill 3 columns in one sheet with data from 3 cells in another sheet

    Thanks for the reply. I do mention that I need the 3 cells - ID, Name, Date from the Start sheet need to be copied to columns B, C and D. Column A in the Complete sheet will have an unknown # of rows with text(comment). I then need to fill B, C and D columns with the ID, Name and Date to last filled row in A.

  4. #4
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,412

    Re: Macro to fill 3 columns in one sheet with data from 3 cells in another sheet

    Did you test the code I proposed?
    Are there any headers in the output sheet? I assumed there was a header in row 1. If it's not the case, change B2 by B1.

  5. #5
    Registered User
    Join Date
    07-08-2013
    Location
    Boston
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Macro to fill 3 columns in one sheet with data from 3 cells in another sheet

    There are headers. I've attached an xls example. I need the 3 cells from the start page in column B to fill in the 3 same named columns in the Complete sheet down to the last row of Column B. Column A and B in the Complete sheet will have an unknown # of rows.
    Basically this is for an import and ID, Name and Date are required for all rows.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    07-08-2013
    Location
    Boston
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Macro to fill 3 columns in one sheet with data from 3 cells in another sheet

    I figure the code out - thx.

    lRow = OutSH.Range("A1:A" & OutSH.Range("A1").End(xlDown).Row).Rows.Count

    sID = Cells(2, 2).Value
    sName = Cells(6, 2).Value
    sDate = Cells(7, 2).Value

    Sheets("Comments").Range("c2:c" & lRow).Value = sID
    Sheets("Comments").Range("d2:d" & lRow).Value = sName
    Sheets("Comments").Range("e2:e" & lRow).Value = sDate

  7. #7
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,412

    Re: Macro to fill 3 columns in one sheet with data from 3 cells in another sheet

    Hi,
    The layout of your file is a bit different that your first statement...
    Using the sample file you sent, here's a code that works :

    Please Login or Register  to view this content.

+ 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. Macro fill cell based on value from another sheet - columns change
    By tcy1227 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-02-2012, 07:01 AM
  2. Replies: 1
    Last Post: 07-30-2012, 02:35 PM
  3. Replies: 4
    Last Post: 04-05-2012, 11:30 AM
  4. As user fills out data sheet, then fill out a results sheet based on data sheet entry
    By clemsoncooz in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-13-2012, 03:57 PM
  5. How to fill columns in one sheet based on data from another sheet?
    By Bookmaster in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-24-2008, 09:59 AM

Tags for this Thread

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