+ Reply to Thread
Results 1 to 7 of 7

Trying to copy data from one cell to another using Macro or VBA.

  1. #1
    Registered User
    Join Date
    08-01-2012
    Location
    muscatine, Iowa, USA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Trying to copy data from one cell to another using Macro or VBA.

    Hi All,
    I'm trying to automate an Excel report. So far, I've been able to do what I need to, but this last piece has me stumped. In an Excel spreadsheet I have a number of macros and some VBA code, but I am stuck. I have inserted blank rows where the data in column E changed from one value to another. The title of my posting is over simplistic, because the data in the table is dynamic and changes from week to week. Here is a section of the table I'm working on. What I would like to do is copy the name from col E3 to A2, E8 to a7, E10 to A9 etc. Recording a simple macro worked until the data changed, for instance Drew was no longer in E8 but E12 because Andy had increased in number of records.

    I am sure that your Gurus will be able to resolve this for me, and save some of my ever diminishing hair

    Thanks

    Barrie

    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor smuzoen's Avatar
    Join Date
    10-28-2011
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2003/2007/2010
    Posts
    610

    Re: Trying to copy data from one cell to another using Macro or VBA.

    Welcome to Excel Forum - to get help with this please upload a sample workbook showing how your data is set out and how your data should appear once the code has run. You will find people reluctant to help as they may need to recreate your workbook (which takes time) and the end result may be not what you require. Please upload a sample workbook with no sensitive data showing how your data is set out and how you finally want it to appear being very specific with your requirements. Make sure you show how you want the data to finally appear. To upload a sample workbook select Go Advanced, Manage Attachments and upload a sample file making sure it contains no sensitive data.
    Hope this helps.
    Anthony
    Pack my box with five dozen liquor jugs
    PS: Remember to mark your questions as Solved once you are satisfied. Please rate the answer(s) by selecting the Star in the lower left next to the Triangle. It is appreciated?

  3. #3
    Registered User
    Join Date
    08-01-2012
    Location
    muscatine, Iowa, USA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Trying to copy data from one cell to another using Macro or VBA.

    Thank you for pointing me in the right direction. I have included the excel file with most of the actual data and in worksheet "What I have" (Red Tab)is the current status of my report which has the data sorted by producer and the blank row inserted at the point where the value in column Ichanges form one value to another, namely Andy to Drew, etc. The Worksheet "What I want" (Green Tab) indicates how I would like it to look when done.

    I will really appreciate the help.
    Attached Files Attached Files

  4. #4
    Valued Forum Contributor smuzoen's Avatar
    Join Date
    10-28-2011
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2003/2007/2010
    Posts
    610

    Re: Trying to copy data from one cell to another using Macro or VBA.

    In your sample workbook you say the name will be in J however in the workbook the namer is in Column I so you will need to adjust the code if the name is in J. You could use the following which will create a new sheet called Results
    Please Login or Register  to view this content.
    See attached workbook.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    08-01-2012
    Location
    muscatine, Iowa, USA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Trying to copy data from one cell to another using Macro or VBA.

    Thanks Anthony, It does just what I want. Does it need to create a new worksheet as I would really like to have it run in the "What I have" worksheet?

    I'm sorry it took me so long to respond, I was on vacation for a week, but am now back in the saddle, so to speak.

    Barrie

    ---------- Post added at 02:00 PM ---------- Previous post was at 01:54 PM ----------

    By the way Anthony, You were spot on with thecolumn ID, it should read column I, as you rightly assumed.

    Thank you.

    Barrie

  6. #6
    Valued Forum Contributor smuzoen's Avatar
    Join Date
    10-28-2011
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2003/2007/2010
    Posts
    610

    Re: Trying to copy data from one cell to another using Macro or VBA.

    Hi Barrie
    Just change the code a little
    Please Login or Register  to view this content.
    I assumed you wanted a new sheet however the above code will just place the names in the What I Have worksheet.

  7. #7
    Registered User
    Join Date
    08-01-2012
    Location
    muscatine, Iowa, USA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Trying to copy data from one cell to another using Macro or VBA.

    Perfect! Thank you Anthony, I really appreciate the help. You've been patient and the outcome couldn't be better. I will mark it as solved and update the "reputation" star.

    Thanks again

    Barrie

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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