+ Reply to Thread
Results 1 to 3 of 3

Applying VBA logic to other cells

  1. #1
    Registered User
    Join Date
    03-19-2024
    Location
    USA
    MS-Off Ver
    2024
    Posts
    5

    Applying VBA logic to other cells

    Hi all,

    So I am stuck on how to go about finishing this sheet I created. The logic of this sheet works like this:

    Ok, I have wrote a section of code that is fairly long and includes many different cells. My question is this: Can I use the VBA code that I have written and push that code to another cell (just the logic of how it works)? I do not just want to simply copy and paste the logic into a cell, but I want the logic to be changed to look at the cells and reformat all the cells to match the new location.

    Here is part of my VBA code below. It basically consist of cell D21 with a dropdown selection of 1,2, or 3. It merges and changes cells based on the selection made in the dropdown. However, I want to move the "logic" part of it to D28. So now D21, if not touched, would not be merged with any other cells. Now I go to the next (D28) option and maybe I want that to be a 3 slot breaker. It would use the logic to merge all three together and so on. Doing this the "old fashion" way, I would have to go through the entire code and change each cell to it's appropriate new location. This is EXTREMELY time consuming and leads to a lot of error. There HAS to be an easier way to achieve this. I want the code to change based on the new location. So this is why a simple copy and paste will not work. Can this be done?




    When a "1" is selected in cell D22 it will show the following:

    1710168662782.png

    When a "2" is selected in cell D22 it will show the following:

    1710168803695.png

    When a "3" is selected in cell D22 it will show the following:

    1710168855472.png

  2. #2
    Registered User
    Join Date
    03-19-2024
    Location
    USA
    MS-Off Ver
    2024
    Posts
    5

    Re: Applying VBA logic to other cells

    This is only a part of my code however you can get an idea how I am doing it.

    Please Login or Register  to view this content.

  3. #3
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: Applying VBA logic to other cells

    With 57 views and no one helping, even though this request isn't difficult to solve using VBA.
    You should attach an example file, remembering to remove any sensitive data.
    Quang PT

+ 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] Applying Predetermined Formatting/Logic to a Downloaded Table
    By lemoncells in forum Excel General
    Replies: 10
    Last Post: 12-05-2023, 11:01 PM
  2. [SOLVED] Sum of cells by logic in a row
    By chintakk in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-16-2020, 10:59 AM
  3. Applying IF logic as VBA down whole column for 5000 rows
    By Ravenous in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-19-2017, 10:11 PM
  4. Search Surrounding Cells and Use Logic Table to Highlight cells
    By Hekagigantes in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-14-2014, 08:36 AM
  5. Replies: 9
    Last Post: 11-20-2013, 09:37 PM
  6. [SOLVED] Sum cells after applying a formula
    By JMarchante in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-08-2013, 07:56 AM
  7. Applying same calculation on various cells
    By AndyOne in forum Excel General
    Replies: 2
    Last Post: 03-09-2005, 09:56 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