Current location - Recipe Complete Network - Complete cookbook - ExcelBA menu
ExcelBA menu
There is no need to use VBA to answer simple questions.

I suggest you try this:

? Scheme 1: Through cell format. The steps are as follows: select the cell to be set > right-click to set the cell format (shortcut Ctr+ 1) > in the pop-up dialog box, under the number tab, select Custom >; Enter the code in the type edit box on the right: [> 6. 1 1]0.00↑; [& lt; 3.5]0.00↓; 0.00→ Scheme 2: completed by text function formula. The formula is as follows (assuming the judgment value is in cell A 1): =TEXT(A 1, "[> 6. 1 1]0.00↑; [& lt; 3.5]0.00↓; 0.00→")

Scheme 3: Complete by text function formula. The formula is as follows (assuming the judgment value is in cell a1): = if (a1> 6. 1 1,a 1 & amp; "↑",IF(a 1 & gt; 3. 1,a 1 & amp; "→",a 1 & amp; "↓"))

Scheme No.1

Option 2

Option 3

If the theme must be handled by VBA, you can consider using VBA event program. The code is as follows (assuming the input value is in cell A 1):

Private Worksheet _SelectionChange(ByVal Target as Range)

If the target. Count = 1 and target. Address = "$A$ 1 "and then

Target = IIf(Target & gt; 6. 1 1。 "↑",IIf(Target & gt; 3.5, target & amp"→ ",target &" ↓ "))

If ... it will be over.

End joint

VBA plan

Note: If you use VBA, you need to save the file as a macro-enabled workbook (or a file with an xls suffix).