+ Reply to Thread
Results 1 to 12 of 12

Problem with Macro Only Running one cell at a time

  1. #1
    Registered User
    Join Date
    03-22-2014
    Location
    Jacksonville, Florida
    MS-Off Ver
    Excel 2007
    Posts
    20

    Problem with Macro Only Running one cell at a time

    Hello,

    I am new to the whole MACRO VBA thing and I am desperately trying to learn. So this is the Situation. I recorded a macro of an If statement on a row. very simple. Some of the rows below ( Like 700) need the same formula that I recorded. I would like to highlight the cells that need the formula and run the macro on them. however the macro only runs one at a time. Is there a way that this can be avoided?

    Thank you so much in advance,

    J

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Problem with Macro Only Running one cell at a time

    Hi,

    How about filtering the column or columns so that only the rows you want to see are visible, then enter the formula in the first cell and copy it down the rest of the visible cells. Then remove the filter.

    I'd avoid any sort of looping macro that moves from cell to cell since loops are generally quite slow and usually filtering data is the easiest way to do this sort of stuff.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Problem with Macro Only Running one cell at a time

    Please Login or Register  to view this content.
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  4. #4
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,521

    Re: Problem with Macro Only Running one cell at a time

    Please Login or Register  to view this content.
    Is this what you mean?
    Adjust the references to what you need.
    HTH
    John

  5. #5
    Registered User
    Join Date
    03-22-2014
    Location
    Jacksonville, Florida
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: Problem with Macro Only Running one cell at a time

    Thank you Richard,

    I have tried that. It just takes time. I want to get to a point where the whole thing is automated. This is what I have.

    In Sheet 1 I have a CODE column. down the column there are about 50 different Codes. Each code has a Corresponding If formula. I wrote that formula on the column next to it.

    In Sheet 2 I have several column with Numerical numbers. One of those Columns however has the Corresponding Code to a part number (the same code in Sheet 1). Is there a way to do something like a Vlookup so that I could Match the two codes and have it spit out the not the value but the formula on sheet 2?

    Let me know what you think.

    and thanks again

  6. #6
    Registered User
    Join Date
    03-22-2014
    Location
    Jacksonville, Florida
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: Problem with Macro Only Running one cell at a time

    THAT IS PERFECT! thank you! that works for my temporary problem. If you look at the post below you will see what the goal is. THANK YOU SO MUCH FOR THIS THO! It is incredible!

  7. #7
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Problem with Macro Only Running one cell at a time

    Quote Originally Posted by boogyman00123 View Post
    Thank you Richard,

    I have tried that. It just takes time. I want to get to a point where the whole thing is automated. This is what I have.
    Hi, perhaps I should have been more explicit. I didn't expect you to do it manually, I had rather assumed you would write a filter macro to do it automatically.

  8. #8
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,521

    Re: Problem with Macro Only Running one cell at a time

    Criteria to filter on is in cell D1.
    Change formula to what you need.
    Change references to suit.
    Assumes that you want to filter on column A

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    03-22-2014
    Location
    Jacksonville, Florida
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: Problem with Macro Only Running one cell at a time

    So I have another question. Im sorry guys im just new. I appreciate the patience.

    So lets say that I create the Macros. For the all type of formulas. Is there something, like a vlookup for macros. As if to search for something and used the assigned Macro?

  10. #10
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,521

    Re: Problem with Macro Only Running one cell at a time

    "For the all type of formulas"
    How many different formulae are you talking about?
    What are the different formulae?
    In Post#8, the value of cell D1 is a variable used for AutuFilter.
    Maybe you could attach a file with the before and after.

  11. #11
    Registered User
    Join Date
    03-22-2014
    Location
    Jacksonville, Florida
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: Problem with Macro Only Running one cell at a time

    Macro Help.xlsx

    well the formulae are if statements that I have created in macros. they basically add or multiply different numbers found in the same sheet. the formulae work. so do the macros. I just have to filterthe data, then run the macro for that code and repeat. There are 57 different codes I have to do this for. I just want to automate it or write something that will read the code and run the appropriate macro on the cell.

    here is the macro that im running now:

    Please Login or Register  to view this content.

  12. #12
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,521

    Re: Problem with Macro Only Running one cell at a time

    Could attach a workbook with has at least all the values for you macros (that is at leat 28).
    I assume that all the macro names, CERT, CSTK, EEBT, EEPR, EEPT, ENAV, EOTH and so on are the values,
    or text if you wish, in Column C.
    Where do you select for the macro that has "no activity" in the formula and where does this "no activity" come from?

    Maybe make a new attachment with all possibilities because now it is only guessing (for me anyway) or
    explain step by step what you do, where you select and what the criteria are. Then the next step.

    I am sure you know what you're after but without proper explanation, I don't.

+ 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. [SOLVED] Problem when running Macro when selected cell is changed.
    By sparker24 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-18-2013, 06:59 PM
  2. Problem running macro when formulas changes cell content.
    By EugeneE in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-23-2013, 08:19 PM
  3. Running a macro each time certain cell content is changed
    By mlcfexcel in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-12-2007, 08:34 PM
  4. QueryTable problem when running first time only
    By T_o_n_y in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-23-2006, 03:25 PM

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