Excel VBA automatically runs conditionally

Updated on technology 2024-05-04
16 answers
  1. Anonymous users2024-02-09

    Upstairs uses cell events, which are done, but not complete, as follows:

    private sub worksheet_selectionchange(byval target as range) 'Cell events.

    dim i as string

    i = cells(7, 4)

    if i = "yes" then rows("8:8"). = true 'Hide line 8.

    if i = "no" then rows("8:8"). = false 'Line 8 is displayed.

    end sub

  2. Anonymous users2024-02-08

    Start with sub, of course you can't, you have to use events.

  3. Anonymous users2024-02-07

    Join the VBA event**.

  4. Anonymous users2024-02-06

    private sub worksheet_selectionchange(byval target as range)

    if = 17 then

    for i = - 1 to + 1

    if cells(i, 2) =mc and cells(i, 17) cells(i, 17). = 3

    elsecells(i, 17). = 0end if

    nextend if

    end sub

    Add this VBA** to the data entry table, and the data will automatically change color during data entry and modification. Note: The variables MC and SI need to be set in advance.

  5. Anonymous users2024-02-05

    It is strongly recommended not to implement this with VBA's chang events. Because,Every time you type or click on a cell, this program will be triggered.,Personally, it's a very annoying thing.。

    It is recommended to use conditional formatting to make the font red in the columns currently in the inventory. This is the most commonly used in this case.

    Email questions if you have a question.

    Examples have been sent to you to see if it works.

  6. Anonymous users2024-02-04

    Suppose your applet is as follows:

    sub test()

    msgbox "ok,test!"

    end sub

    Then you can add the following **, hit the open workbook and automatically execute the above applet sub auto open().

    testend sub

  7. Anonymous users2024-02-03

    Excel's VBA module is used to write**and store macros**,Private Sub Workbook Open( )This is the workbook open event, when you open it, the event can occur, as shown below**When running, it will pop up a macro dialog box--- add it as your favorite name in the name bar --- run.

    private sub workbook_open()msgbox "You open a workbook"

    end sub

    What do I add** to make it run automatically? You don't need to add anything**, you click on the menu bar and click on the green triangle or f5 to run.

  8. Anonymous users2024-02-02

    The VBA module needs to be triggered by an event that can be recognized in order to run, such as activating a worksheet.

  9. Anonymous users2024-02-01

    There is no way to do this, if someone else sets the macro security to "high" or "medium", it will automatically prevent the VBA from running or prompt whether to run the macro, you can't set the security of changing the macro in **, if you can set the security of changing the macro in **, then the macro security of excel is meaningless.

  10. Anonymous users2024-01-31

    Change your change event to a calculate event to run automatically.

    calculate is an event that runs in response to a change in the value of a formula.

  11. Anonymous users2024-01-30

    Add the Worksheets SelectionChange process to VBA and call the contents of the Worksheets Change function. Or try switching to a different table and take a look at the switch back.

  12. Anonymous users2024-01-29

    Put the program into the calculate event of the worksheet, that is, this event is generated after the worksheet is recalculated.

    When the value of the formula changes, i.e. the worksheet is recalculated, the private sub worksheet calculate()columns() event is executed after the calculation"a:f").autofitend sub

  13. Anonymous users2024-01-28

    There is no way to do this, if someone else sets the macro security to "high" or "medium", it will automatically prevent the VBA from running or prompt whether to run the macro, you can't set the security of changing the macro in **, if you can set the security of changing the macro in **, then the macro security of excel is meaningless.

  14. Anonymous users2024-01-27

    sub a()

    for i=1 to 200

    call macro two.

    nextend sub

    I don't really understand the result you want.

    You can add a sentence ** at the end of macro two. Let b1 increase by 1

    sub macro two().

    Here's your **, and the last sentence is added as follows:

    b1]=[b1]+1

    end sub

  15. Anonymous users2024-01-26

    You want the user to click on the numerical adjustment key, and macro two will run automatically, right?

    Use the worksheet change event and then call "macro two" and you're good to go.

    Now the numeric adjustment key is not from the macro, but can also be controlled with the macro - the macro xx can control the value of cell B1.

    Macro xx can call ** in macro 2.

    This macro xx is what you want to run continuously and automatically 200 times, that is, the number of b1 changes 200 times in a row, and macro 2 also runs 200 times.

  16. Anonymous users2024-01-25

    First of all, be sure to write ** in auto open, or in the workbook open event.

    Secondly, to determine the current time, you can use minute(now()), right?

    Finally, save it, you can record one.

    Add, if judgment doesn't need to be written, right?

Related questions
17 answers2024-05-04

It could be that the system files are missing, or there is a virus! It is recommended to reinstall the system. >>>More

18 answers2024-05-04

1 Virus destruction.

Soon after the advent of computers, computer viruses also emerged. When the Internet has become the main information artery of today's society, the spread of viruses is more convenient, so it also interferes with and disrupts our normal work from time to time. A typical example is the "Shockwave" virus that wreaked havoc on computers around the world some time ago, and when it occurs, it will also indicate that the system will automatically start after 60 seconds. >>>More

1 answers2024-05-04

It seems to have hit the "shock wave" Emergency measures: If you are accidentally infected with the virus, you can use the following steps to detect and kill: 1 >>>More

8 answers2024-05-04

Start the program Start Turn off the programs you don't want >>>More