Home > Software engineering >  Subtracting the two columns of data to excel, the new insert a column, write subtraction results
Subtracting the two columns of data to excel, the new insert a column, write subtraction results

Time:11-02

Subtracting the two columns of data to excel, the new insert a column, write subtraction result, the function, using vb to how to write code?

CodePudding user response:

 with thisworkbook. Sheets (sheet)//operation schedule sheet said pages 
//assume that column column inserts A column to reduce B C
Ki=range (" A65536 "). The end (xlup). The row//there said in A column data part of the number of rows

The columns (" B, C). Select
Selection. Insert shift:=xlToRight//insert column

For I=1 to ki
Cells (I, 3)=CDBL (. Cells (I, 1)) - CDBL (. Cells (I, 2))//converted to decimal format is presupposed
Next I

CodePudding user response:

It is more convenient to write a macro is not directly in the excel.

CodePudding user response:


It is best to insert in Excel macro, writing in the new column by cell formula, rather than a specific number,
  •  Tags:  
  • VBA
  • Related