Home > Software engineering >  Before a cell to text calculation formula (38-28), how a cell after get value (10)
Before a cell to text calculation formula (38-28), how a cell after get value (10)

Time:09-15

is shown in figure, how in any text a cell, after the calculation formula of calculating the value, and implement a simple operation can be achieved, (before I used the evaluate, but only for a particular column value, changing the column will have to set the reference area, very inconvenient)

CodePudding user response:

Cell change events

CodePudding user response:

Data extraction, operators recognition, function composition calculation,

CodePudding user response:

Can increase the processing method in Sheet Change events:
 
Option Explicit

'there's a problem, is the time when the input subtration Excel automatically as the date processing.
Private Sub Worksheet_Change (ByVal Target As Range)
Dim reg As Object
The Set reg=CreateObject (" vbscript. Regexp ")
Reg. The Pattern="\ d + + \ [- */] \ d +"

Then If reg. Test (Target Text)
Cells (Target. Row, Target. The Column + 1)=the Evaluate (Target. The Text)
End the If
End Sub

Run the example:

Download address:
Link: https://pan.baidu.com/s/1mzx1hklZHInDCQywXsmYbA
The extracted code: v3k2
  • Related