+ Reply to Thread
Results 1 to 6 of 6

Excel 2010 VBA copy the contents of one cell to multiple others

  1. #1
    Registered User
    Join Date
    09-02-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    16

    Excel 2010 VBA copy the contents of one cell to multiple others

    Ok can someone look at my code below and point me in the right direction. Forgive me I am no where near a expert at this.

    Basically C is column number and i is row number and what I am trying to achieve is take the forumla in A1 of sheet and copy it to E6 to I6 then the value of A2 in sheet to E7 to I7 etc.

    Please Login or Register  to view this content.
    Last edited by Munkle555; 09-08-2015 at 08:17 AM.

  2. #2
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: Excel 2010 VBA help

    have you tried recording this as a macro? it should write the code for you. ie Developer>Record macro and then do the actions yourself ie Copy cell A1 highlight E6 to I6 and Paste
    If someone has helped you then please add to their Reputation

  3. #3
    Registered User
    Join Date
    09-02-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Excel 2010 VBA help

    Ok now I feel stupid thanks very much. If anyone does know whats wrong with the above though I would still like to know

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Excel 2010 VBA help

    Please take a moment to read the forum rules and then amend your thread title to something descriptive of your problem - not what you think the answer might be. (think google search terms?). Once you have done this please send me a PM and I will remove this request. (Also, include a link to your thread - copy from the address bar)

    Many members search our previous posts, and thread titles play a big part of the search. I doubt anybody would do a search based on your title?

    To change a Title on your post, click EDIT POST then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    (note: this change is not optional )

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Forum Expert Doc.AElstein's Avatar
    Join Date
    05-23-2014
    Location
    '_- Germany >Outside Building things.... Mostly
    MS-Off Ver
    Office 2003 2007 2010 PC but Not mac. XP and Vista mostly, sometimes Win 7
    Posts
    3,618

    Re: Excel 2010 VBA help

    Hi Munkle,

    . There are infinite ways to do this. Before I explain PLEASE follow FDibbins request and re- name the Title. ****I would suggest something like “Copy Paste Method Formulas and Copy Paste Method Values” . Not only is that good for the reasons FDibbins said, but it could encourage more / better answerers and contribute to this Thread – As I said there are infinite ways to do this, I do not have time to suggest them all, but others may contribute..
    .

    . For Yous specific requirement:

    . ( As pjwhitfield very rightly and correctly said the macro recorder is always a very good start point. In your case pay particular attention to the different options to paste in whilst recording the macro. )


    Quote Originally Posted by Munkle555 View Post
    … …“…. take the formula in A1 of sheet and copy it to E6 to I6 then the value of A2 in sheet to E7 to I7 ……“..
    …. If anyone does know whats wrong with the above though I would still like to know
    . It appears a lot of basic concepts you have wrong. I have done one way for you, keeping close to your original code:

    Starting with this

    Using Excel 2007
    Row\Col
    A
    1
    =2*3
    2
    7
    Sheet

    Then this code :

    Please Login or Register  to view this content.

    Gives you this


    Using Excel 2007
    Row\Col
    E
    F
    G
    H
    I
    6
    =2*3
    =2*3
    =2*3
    =2*3
    =2*3
    7
    7
    7
    7
    7
    7
    Sheet

    .. see some of my explain comments in the code.

    Alan

    ***(This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)EDit: As you have forfilled the request to re title, I shall continue!!!!
    Last edited by Doc.AElstein; 09-08-2015 at 09:10 AM.
    '_- Google first, like this _ site:ExcelForum.com Gamut
    Use Code Tags: Highlight code; click on the # icon above,
    Post screenshots COPYABLE to a Spredsheet; NOT IMAGES PLEASE
    http://www.excelforum.com/the-water-...ml#post4109080
    https://app.box.com/s/gjpa8mk8ko4vkwcke3ig2w8z2wkfvrtv
    http://excelmatters.com/excel-forums/ ( Scrolll down to bottom )

  6. #6
    Forum Expert Doc.AElstein's Avatar
    Join Date
    05-23-2014
    Location
    '_- Germany >Outside Building things.... Mostly
    MS-Off Ver
    Office 2003 2007 2010 PC but Not mac. XP and Vista mostly, sometimes Win 7
    Posts
    3,618

    Re: Excel 2010 VBA help

    Hi Munkle,

    . Thanks for correcting the title so quick. ( Please remember to PM FDibbins and tell’im )

    . Here was a recent Thread with some other methods of Copying and pasting,
    http://www.excelforum.com/excel-prog...ml#post4161312
    .. although I think the Resize bit is the key to your requirement of copying the contents of one cell to multiple others

    . That thread above was a bit more advanced, and allows you to Pick out easily parts of a table and copy that. However one method there, mine, was only copying values so would not have worked for copying your formula.
    But the code is well commented to explain what is going on.
    .
    . It is with Googling as I suggest in my Signature below to find other similar Threads.

    .... while I am here , another method, which rather than copies, per say, writes in the values from somewhere to somewhere else. This is limited again in exactly what you can copy , but you do have options such as .Values or .Formulas.
    .
    . Applied to your particular case try these lines tacked on just before the end of the code I did for you.

    Please Login or Register  to view this content.

    Again I think it is the Resize "Thing" ( Property as it is called ) that does the busines for you


    Alan

+ 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. UDT passing byref works in WinXP Excel 2010 fails on Win7 64 bit Excel 2010 32 bit
    By MarkInKeizer in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-09-2014, 11:49 AM
  2. 2010 Word form fields populated with 2010 Excel data
    By pballard66 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 04-23-2014, 11:55 AM
  3. Replies: 0
    Last Post: 12-18-2013, 07:59 PM
  4. Excel 2010, Access 2010, SQL Insert and Update Statments and NULL value in Field
    By jmmach72 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-24-2013, 02:35 PM
  5. Copying worksheets from excel to word in vba as images
    By papasideris in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-18-2012, 11:32 AM
  6. Searching the particular numberfrom excel'2010 table and locate the number in Word'2010
    By jaffirahamed1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-21-2012, 08:09 AM

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