+ Reply to Thread
Results 1 to 8 of 8

Excel 2007 : How to copy same records to different columns with month variable

  1. #1
    Registered User
    Join Date
    03-25-2011
    Location
    istanbul
    MS-Off Ver
    Excel 2010 / 2007
    Posts
    4

    How to copy same records to different columns with month variable

    hello everyone!

    i am trying to make an excel sheet which has 2 sheets

    one sheet is alike a form and second sheet keeps the record. but the structure is same except sheet 2 has 12 more columns for keeping montly records,

    in first sheet there is a month selection and a column to fill
    and at second sheet there are 12 columns same with the sheet 1 for each month

    i want excel to take the records in sheet 1 column and month selection and compare it with the sheet 2 , if there is an entry before a error message otherwise it shall copy all records to the relevant month's column

    i am sure it is quite easy for experts but i couldnt solve it .

    thanks beforehand for your helps
    Attached Files Attached Files
    Last edited by albatros79; 04-06-2011 at 03:06 AM. Reason: forum rules

  2. #2
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: How to copy same records to different columns with month variable

    Hi albatros79
    Welcome to the forum,
    One way....Copy the Excel VBA code
    Select the workbook in which you want to store the Excel VBA code
    Hold the Alt key, and press the F11 key, to open the Visual Basic Editor
    Choose Insert | Module
    Where the cursor is flashing, choose Edit | Paste
    To run the Excel VBA code:

    Please Login or Register  to view this content.
    Choose Tools | Macro | Macros
    Select a macro in the list, and click the Run button
    Last edited by pike; 03-27-2011 at 08:04 PM.
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  3. #3
    Registered User
    Join Date
    03-25-2011
    Location
    istanbul
    MS-Off Ver
    Excel 2010 / 2007
    Posts
    4

    Re: How to copy same records to different columns with month variable

    thank you pike!
    it seems work but when we run the macro twice it continues pasting all columns to the below of colum so column is going down , and secondly , i want it to check if there is already a value in sheet 2 matched column and if yes ask me if i choose overwrite.
    can we do it?

  4. #4
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: How to copy same records to different columns with month variable

    Hi albatros79,
    Hmm... that would mean you could have twelve messages

  5. #5
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: How to copy same records to different columns with month variable

    Hi albatros79

    Tyr this ....
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    03-25-2011
    Location
    istanbul
    MS-Off Ver
    Excel 2010 / 2007
    Posts
    4

    Re: How to copy same records to different columns with month variable

    the values was number not dates. and actually this list is quite long in normal excel sheet
    i will attach it too for you to see what i mean . there are around 380 rows. so if it asks me for each row it would take about 5 mins to confirm .
    let me explain in the real sheet.
    my goal is to copy "MONTLY RUN HOURS" column in RUNNING HOURS sheet to relevant month column at "RUNNING HOURS RECORDS "sheet when i push the rec button. but if there is a old data in matched months column it should ask if overwrite. but as you see there are plenty rows so crew can record 100 in 1 day and 150 and 2nd day and rest in 3rd day. so it should ignore blank cells in "MONTLY RUN HOURS" column when pasting to "RUNNING HOURS RECORDS "sheet.
    also new items can be added to the list .

    am i too demanding??
    Attached Files Attached Files
    Last edited by albatros79; 03-28-2011 at 02:26 PM.

  7. #7
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: How to copy same records to different columns with month variable

    Hi albatros79
    but it just wont work if you make lots of changes but try it
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    03-25-2011
    Location
    istanbul
    MS-Off Ver
    Excel 2010 / 2007
    Posts
    4

    Re: How to copy same records to different columns with month variable

    Pike , i guess i made it!!
    editing recorded macro and digging excel vba forums helped :

    i would like to share it with you
    macro is for the original file fyi

    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)

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