Home > Software engineering >  Turn to EXCEL macros cannot perform insert column
Turn to EXCEL macros cannot perform insert column

Time:09-19

Good god, ask a small white problem, because of work need to do it himself a small macros, don't know why with the command "insert column" macro, execution, only have my import table is inserted into the three columns of data, and other cells are turned into a blank, what I need is inserted after the specified position 3 columns, and the input formula for statistical number, the attachment is I do of macros and a form file, have a great god help to check what the problem is,
The effect of need

After execution of

Macros:
Sub macro (1)
'
"Acer 1
'

'
Cells. Select
With the Selection. The Interior
. The Pattern=xlNone
. TintAndShade=0
. PatternTintAndShade=0
End With
Columns (R: "R"). Select
Range (" R2 "). The Activate
Selection. Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Selection. Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Selection. Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Range (" R3 "). Select
ActiveCell. FormulaR1C1="SDT"
Range (" S3 "). Select
ActiveCell. FormulaR1C1="the bluetail ticket tracker (BTT)"
Range (" T3 "). Select
ActiveCell. FormulaR1C1="HHT"
Range (" R3, R4). Select
With Selection
The HorizontalAlignment=xlCenter
The VerticalAlignment=xlCenter
. WrapText=False
. The Orientation=0
. AddIndent=False
. IndentLevel=0
. ShrinkToFit=False
. ReadingOrder=xlContext
.
MergeCells=FalseEnd With
Selection. The Merge
Range (" S3, S4). Select
With Selection
The HorizontalAlignment=xlCenter
The VerticalAlignment=xlCenter
. WrapText=False
. The Orientation=0
. AddIndent=False
. IndentLevel=0
. ShrinkToFit=False
. ReadingOrder=xlContext
.
MergeCells=FalseEnd With
Selection. The Merge
Range (T3, T4 "). Select
With Selection
The HorizontalAlignment=xlCenter
The VerticalAlignment=xlCenter
. WrapText=False
. The Orientation=0
. AddIndent=False
. IndentLevel=0
. ShrinkToFit=False
. ReadingOrder=xlContext
.
MergeCells=FalseEnd With
Selection. The Merge
Range (R5). Select
ActiveCell. FormulaR1C1="=the IF (RC [3] <24.77, the IF (RC [1]="" "" "" "", RC [1]), "" "") "
Range (R5). Select
Selection. The AutoFill Destination:=Range (" R5: R99 ")
Range (" R5: R99 "). Select
Range (" S5). Select
ActiveCell. FormulaR1C1=_
"=the IF (AND (RC [4] & gt;=24.77, RC [4] <63.15), the IF (RC, [2]="" "" "" "", RC [2]), "" "") "
Range (" S5). Select
Selection. The AutoFill Destination:=Range (" S5: S99 ")
S5: S99 Range (" "). Select
Range (" 0 "). Select
ActiveCell. FormulaR1C1="=the IF (RC [5] & gt;=63.154, the IF (RC [3]="" "" "" "", RC [3]), "" "") "
Range (" 0 "). Select
Selection. The AutoFill Destination:=Range (" T5: T99 ")
Range (" T5: T99 "). Select
Columns (R: "T"). Select
Range (" R2 "). The Activate
With the Selection. The Font
Color=- 16776961
. TintAndShade=0
End With
End Sub

CodePudding user response:

Step, see where a line is not in conformity with the predicted results for you

CodePudding user response:

All commented On the Error Resume Next statement, running in the VBA IDE,
The error and then click the debugging, the cursor will stop error in the statement,
Or
In doubt may have a logical error statements in advance to set breakpoints, run through the breakpoint interrupt,

At this point can be used in the immediate window
? The variable name
Or
? The function name () function parameter
Or
Process (parameters)
Auxiliary debugging,
  • Related