+ Reply to Thread
Results 1 to 11 of 11

macro codes for inserting formula to various similar worksheets

  1. #1
    Registered User
    Join Date
    11-19-2012
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    81

    macro codes for inserting formula to various similar worksheets

    Hi!
    I have 25 SIMILAR excel workbooks. And each workbook consists of 48 SIMILAR worksheets each. I want to insert two different formulas in all these worksheets. E.g. in all these 25*48 worksheets, in cell C2, I want to insert =if(A1=0,"Pass","Fail"). And in cell E2, I want to insert =sum(E10:E20). Could you please give me the codes to run on macro. Thanks.

  2. #2
    Forum Contributor ragavan.sridar1's Avatar
    Join Date
    11-19-2012
    Location
    India
    MS-Off Ver
    Excel 2010, Excel 2003
    Posts
    208

    Re: macro codes for inserting formula to various similar worksheets

    instead of trying a macro you can use the option "select all sheets" and can give the formula..

    Just a thought...
    Thanks!
    Raga.

    Please,mark your thread [SOLVED] if you received your answer.

    Click the little star * below, to give some Rep if you think an answer deserves it.

    I learnt so many things from these links.

  3. #3
    Registered User
    Join Date
    11-19-2012
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    81

    Re: macro codes for inserting formula to various similar worksheets

    Is it possible to select all sheets and insert a formula in a particular cell in all the sheets in one go? Pls tell me how to do that if possible.

  4. #4
    Registered User
    Join Date
    11-19-2012
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    81

    Re: macro codes for inserting formula to various similar worksheets

    Oops! I know what you are talking about. But that won't help much. I would prefer macro codes which will be quicker and easier. Someone pls advice.

  5. #5
    Forum Guru jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: macro codes for inserting formula to various similar worksheets

    Hi rohit43

    This does by Code what Raga suggests.
    Please Login or Register  to view this content.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  6. #6
    Registered User
    Join Date
    11-19-2012
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    81

    Re: macro codes for inserting formula to various similar worksheets

    Hi! John,
    I will be able to try this later today and definitely give you a feedback on this. But I think, this is what I was looking for. Could you also tell me how to write these kind of codes please. Thanks in advance.

  7. #7
    Forum Guru jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: macro codes for inserting formula to various similar worksheets

    Hi rohit43

    You can start by recording the Key Strokes to do as you require. If you were to do this on a COPY of your actual file you'll see the resulting recorded code is just about the same as I presented.

    The next issue you need to deal with is writing the code so the code does this same thing
    in all these 25*48 worksheets
    and that's doable. If you need help with that just holler.

  8. #8
    Registered User
    Join Date
    11-19-2012
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    81

    Re: macro codes for inserting formula to various similar worksheets

    Hi! John
    When I record a macro the resulting code is not exactly the same. E.g. "For Each aSheet In ActiveWorkbook.Sheets" or any other code which gives the command to move to all the worksheets or another workbook in the same folder etc. would not appear in the recording. So, where can I get the idea of writing these kind of codes. Please advice.

  9. #9
    Forum Guru jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: macro codes for inserting formula to various similar worksheets

    Hi rohit43

    Well I gave you an example of how to do that.
    However, Google is your best Friend...there's not a question that's been asked that hasn't been answered on the World Wide Web. Google it.
    Last edited by jaslake; 01-16-2013 at 06:31 PM.

  10. #10
    Registered User
    Join Date
    11-19-2012
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    81

    Re: macro codes for inserting formula to various similar worksheets

    Thanks ever so much. And sorry for taking so many days to close the thread.

  11. #11
    Forum Guru jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: macro codes for inserting formula to various similar worksheets

    You're welcome...glad I could help. Thanks for the Rep.

+ 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