Detailed explanation of excel vba with statement example

  In excel, the use of the vba statement is a relatively advanced tutorial, and in it, the with statement is one of the more convenient statements in the vba statement. It is suitable for executing a series of statements on an object. Many small partners are in When using with, it is not clear how to use it correctly, so in order to help you, Xiaobian brings a detailed explanation of the excel vba with statement example in the excel vba example tutorial today to help you understand the use of the with statement more intuitively. .

 

  Example: We now want to display the address of cell A1, the name of the parent of cell A1 and change the value of cell A1 to: Excel VBA makes the job more efficient.

 

  Normally we would write this:

 

excel

 

  result:

 

excel vba example tutorial

 

Detailed explanation of excel vba with statement example

 

  Now let's use the With statement to see how to write:

 

excel

 

  result:

 

excel vba example tutorial

 

Detailed explanation of excel vba with statement example

 

  In this way, is it a lot easier? Just use with and end with End With. After getting the attribute value, you don't need to repeat the object name. It is very convenient. You can try it at work. , I believe you will love it.

 

  Reference: http://www.285868.com/jiaocheng/jpc/show-11874.html

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326224764&siteId=291194637