Home > Software engineering >  Why do Excel macro always appear the following error
Why do Excel macro always appear the following error

Time:11-30

Sub the clear ()

Workbooks (" Data. XLSM "). Activate
Sheets (" Sheet1 "). The Visible=True
Sheets (" Sheet1 "). Select
Cells (). The clear

With Sheets (" temp ")
The Visible=True
Cells (). The clear
End With

Sheets (" FBL1N "). Select
Cells (). The clear

End Sub

Sub xin ()
Application. ScreenUpdating=False
Application. DisplayAlerts=False

Dim bottom As an Integer, bottom1 As an Integer, As an Integer x, y As an Integer, z As an Integer, h As an Integer, c As an Integer, a As an Integer, n As an Integer, curr As Integer
Dim arr, arr1 arr2, arr3
Dim amount As Double, amount1 As Double, amount2 As Double, amount3 As Double, amount4 As Double, amount5 As Double, r2 As r1 As Double Double
Dim EUR_rate As Double, JPY_rate As Double

EUR_rate=Sheets (" Macro "). The Range (" B2 ")
JPY_rate=Sheets (" Macro "). The Range (" B3 ")

A=0
C=1
Amount=0
Bottom1=1

Workbooks. Open Filename:=ThisWorkbook Path & amp; "/" & amp; "The template. XLSX"

Workbooks (" Data. XLSM "). Activate
Workbooks (" Data. XLSM "). Activate
Sheets (" FBL1N "). Select
Bottom=Sheets (" FBL1N ".) Cells. The Find (" * ",,,,, xlPrevious). Row
ActiveSheet. Range (" A1: V "& amp; Bottom). AutoFilter Field:=3, Criteria1:="="
ActiveSheet. AutoFilter. Range. SpecialCells (12). Copy Sheets (" Sheet1 "). The Range (" a1 ")
ActiveSheet. Range (" A1: V "& amp; Bottom). AutoFilter Field:=3

Sheets (" Sheet1 "). Select

For To [n65536]. Curr=1 End (3). The Row

If the Range (" n "& amp; Curr.) Value="https://bbs.csdn.net/topics/JPY" Then
Range (" o "& amp; Curr.) (Range (Value=https://bbs.csdn.net/topics/Round "o" & amp; Curr)/JPY_rate, 2)
End the If

If the Range (" n "& amp; Curr.) Value="https://bbs.csdn.net/topics/EUR" Then
Range (" o "& amp; Curr.) (Range (Value=https://bbs.csdn.net/topics/Round "o" & amp; Curr)/EUR_rate, 2)
End the If

Next

Range (" O1 "). Select
ActiveWorkbook. Worksheets (" Sheet1 "). Sort. SortFields. Clear
ActiveWorkbook. Worksheets (" Sheet1 ".) Sort. SortFields. Add the Key:=Range (" O1 "), _
SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
With ActiveWorkbook. Worksheets (" Sheet1 "). The Sort
. SetRange Range (A2: "V" & amp; Range (" o65536 "). The End (3). The Row)
The Header=xlNo
The MatchCase=False
The Orientation=xlTopToBottom
. SortMethod=xlPinYin
. Apply
End With

Rows (" 1 "). Select
Selection. Delete shift:=xlUp

Arr=Range (o1: "o" & amp; Range (" o65536 "). The End (3). The Row)
Arr1=Range (b1: "b" & amp; B65536 Range (" "). The End (3). The Row)

For y=Range (" o65536 "). The End (3). The Row To Step 1-1

If arr (y, 1) & lt; - 8000000 Then

Amount2=0
Amount3=0
Amount4=0
Amount5=0

N=Abs (Int (arr (y, 1)/8000000))

Sheets (" FBL1N "). Select

R1=Sheets (" FBL1N "). [b: b] Find (arr1 (y, 1), Lookat:=xlWhole). Row

ActiveSheet. Range (" A1: V "& amp; Bottom). AutoFilter Field:=2
ActiveSheet. Range (" A1: V "& amp; Bottom). AutoFilter Field:=2, Criteria1:=arr1 (y, 1), the Operator:=xlFilterValues
Rows (" 1 "). EntireRow. Hidden=True
ActiveSheet. AutoFilter. Range. SpecialCells (12). Copy Sheets (" temp "). The Range (" a1 ")

Workbooks (" Data. XLSM "). Activate
Sheets (" temp "). Select

For z=1 To n

Workbooks (" Data. XLSM "). Activate
Sheets (" temp "). Select

Arr2=Range (o1: "o" & amp; Range (" o65536 "). The End (3). The Row 1)
Arr3=Range (" q1: q & amp;" Range (" q65536 "). The End (3). The Row 1)

For h=1 To [o65536]. End (3). The Row - 1
Amount2=amount2 + arr2 (h, 1)
Amount3=amount2 - arr2 (h, 1)
Amount4=amount4 + arr3 (h, 1)
Amount5=amount4 - arr3 (h, 1)

If amount2 & lt; - 8000000 Then

Range (" a1: v "& amp; H - 1). Copy

Workbooks (" template. XLSX "). Activate
Sheets (" FBL1N "). The Range (" a2 "). Select
ActiveSheet. Paste
Range (" n "& amp; Range (" o65536 "). The End (3). The Row). Offset (1, 0) Value=https://bbs.csdn.net/topics/Range (" n "& amp; Range (" o65536 "). The End (3). The Value
Row).Range (" o "& amp; Range (" o65536 "). The End (3). The Row). Offset (1, 0) Value=https://bbs.csdn.net/topics/amount3
Range (" o "& amp; Range (" o65536 "). The End (3). The Row). NumberFormatLocal="# # # 0.00 _"
Range (" p "& amp; Range (" c65536 "). The End (3). The Row). Offset (1, 0) Value=https://bbs.csdn.net/topics/Range (" p "& amp; Range (" c65536 "). The End (3). The Value
Row).Range (" q "& amp; Range (" c65536 "). The End (3). The Row). Offset (1, 0) Value=https://bbs.csdn.net/topics/amount5
Range (" q "& amp; Range (" o65536 "). The End (3). The Row). NumberFormatLocal="# # # 0.00 _"
Range (" b "& amp; Range (" c65536 "). The End (3). The Row). Offset (1, 0)=Range (" b "& amp; Range (" c65536 "). The End (3). The Row)

Range (Cells (Range (" o65536 "). The End (3). A Row, "a"), Cells (Range (" o65536 "). The End (3). A Row, "v")). Interior. ColorIndex=6

ActiveWorkbook. SaveCopyAs ThisWorkbook. Path & amp; "/" & amp; "Data" & amp; C & amp; ". XLSX "
Range (a2: "v" & amp; Range (" o65536 "). The End (3) the Row + 1). The clear
C=c + 1

nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  •  Tags:  
  • VBA
  • Related