Home > Software engineering >  For help under the macro how to do
For help under the macro how to do

Time:09-24

As shown in the picture, and now want a color in the column of data change when the next grid will automatically run a "macro 1" how to put this macro to come, ask everybody to help


CodePudding user response:

The building Lord consult, didn't you make those cells, how to judge whether to call "macro" 1,
If there is no law, and is indeed a good fill color in advance,
So you can instead to Target. The Interior. The Color judging whether the value of is XXXX value,


Words, the original poster with "two pen input method", this really is not too common,
Tutorial I've seen it, but it's coding and root distribution, I'm not accustomed to, always mixed with wubi... Finally give up it,
The building Lord to use habits?

CodePudding user response:

Upstairs you really careful, thank you for your answer, but I have a question, is the position of these colored cell in the table is not fixed, only their name is fixed, only when they have data to change run macros 1, not to have color change to run the macro 1. Very much like you to help me, thank you very much

CodePudding user response:

refer to the second floor xiaoxifeng14 response:
upstairs you really careful, thank you for your answer, but I have a question, is the position of these colored cell in the table is not fixed, only their name is fixed, only when they have a data change operation macros 1, not to have color change to run the macro 1. Very much like you to help me, thank you very much

The event is triggered when "content change", color change is not triggered,
You said "name", name is on the cell's address?
If it is, but can be by the above code line number, column number, then from thisworkbook. Enumeration RefersToR1C1 attribute Names,
Look have "row number and column number consistent" ah, if there is a call macro 1, and then exit the loop bai,

CodePudding user response:

Well, I'm just learning may be, don't understand what you mean, for example, "diameter" this column, when he has data changes under performs macro 1, but the "diameter" does not necessarily on the position in the table, this should be how to write, thank you

CodePudding user response:

Originally you said "name", only the text content within the cell in the form,
I thought you really play the "cell named" (although this is not something profound ),

Like you ZhuTie pictures in line 33: A33 to F33 these cells, there is the "name",
Is likely to be the front insert some data, is originally in 33 lines, line became the 45, is it?
At 33, A36 changes, need to "perform macro 1";
But later changed to 45, A36 change, can't again to carry out macro 1,
Is that what you mean?

In fact it is not difficult, "line" location is not fixed, at least the column location should be fixed!
So, as I code in the 1st floor picture:
First take "change" cell line number, column number,
"Rough at this value judgment", "clearly beyond the scope of", no matter the directly, quit,
Such as column values of 7 (for 1 to 5 column is "to tube"), or a line number value is very small, such as
Then, is the "may have to tube" :
If the column value is 1, 35, at the same time, the line number is to "diameter" is in line 33, because line 35> 33, and performs macro 1
Suppose another A35 cell change, triggering event:
But now the retrieved "diameter" on the 45th line, now 35 <45, and "exit" directly,

Other "length", "width" and so on, can be on,
Even if change performs macro 1 "diameter", "length" change performs macro 2, "width" macro 3 change implementation, etc... Can all,
  •  Tags:  
  • VBA
  • Related