Home > OS >  Why I EXCEL VBA code is invalid, and the card
Why I EXCEL VBA code is invalid, and the card

Time:12-01

My code is as follows

Private Sub Worksheet_Change (ByVal Target As Range)

Dim As Integer I

For I=2 To [A1048576]. End (3). The Row

If Cells (I, 1) & lt;> "" Then

If Sheet1. Cells (6, 10)="US" Then Cells (I, 2)="USD"

ElseIf Sheet1. Cells (6, 10)="CA" Then Cells (I, 2)="CAD"

ElseIf Sheet1. Cells (6, 10)="MX" Then Cells (I, 2)="MXN
"
ElseIf Sheet1. Cells (6, 10)="JP" Then Cells (I, 2)="was"

ElseIf Sheet1. Cells (6, 10)="UK" Then Cells (I, 2)="GBP"

ElseIf Sheet1. Cells (6, 10)="DE" Or Sheet1. Cells (6, 10)="FR" Or Sheet1. Cells (6, 10)="IT" Or Sheet1. Cells (6, 10)="ES" Then Cells (I, 2)="EUR"

End the If

Cells (I, 3)=Sheet1. Cells (6, 12)

Cells (I, 4)=Sheet1. Cells (3, 10)

Cells (I, 5)="EXACT"

If Sheet1. Cells (6, 16)="show the amount Then Cells (I, 6)=the Evaluate (" SUMPRODUCT ((sponsor products on the report! A: A=A2) * (sponsor products on the report! C: C=B2) * ISNUMBER (FIND (work platform! $L $6, sponsor products on the report! D: D)) * (sponsor products on the report! F: F=D2) * (sponsor products on the report! G: G=E2), sponsor products on the report! H: H)
")
ElseIf Cells (6, 16)="hits" Then Cells (I, 6)=the Evaluate (" SUMPRODUCT ((sponsor products on the report! A: A=A2) * (sponsor products on the report! C: C=B2) * ISNUMBER (FIND (work platform! $L $6, sponsor products on the report! D: D)) * (sponsor products on the report! F: F=D2) * (sponsor products on the report! G: G=E2), sponsor products on the report! I: I)
")
ElseIf Cells (6, 16)="CTR" Then Cells (I, 6)=the Evaluate (" SUMPRODUCT ((sponsor products on the report! A: A=A2) * (sponsor products on the report! C: C=B2) * ISNUMBER (FIND (work platform! $L $6, sponsor products on the report! D: D)) * (sponsor products on the report! F: F=D2) * (sponsor products on the report! G: G=E2), sponsor products on the report! J: J)
")
ElseIf Cells (6, 16)="CPC" Then Cells (I, 6)=the Evaluate (" SUMPRODUCT ((sponsor products on the report! A: A=A2) * (sponsor products on the report! C: C=B2) * ISNUMBER (FIND (work platform! $L $6, sponsor products on the report! D: D)) * (sponsor products on the report! F: F=D2) * (sponsor products on the report! G: G=E2), sponsor products on the report! K: K)
")
ElseIf Cells (6, 16)="AD" Then Cells (I, 6)=the Evaluate (" SUMPRODUCT ((sponsor products on the report! A: A=A2) * (sponsor products on the report! C: C=B2) * ISNUMBER (FIND (work platform! $L $6, sponsor products on the report! D: D)) * (sponsor products on the report! F: F=D2) * (sponsor products on the report! G: G=E2), sponsor products on the report! L: L)
")
A cosine ElseIf Cells (6, 16)="" Then Cells (I, 6)=the Evaluate (" SUMPRODUCT ((sponsor products on the report! A: A=A2) * (sponsor products on the report! C: C=B2) * ISNUMBER (FIND (work platform! $L $6, sponsor products on the report! D: D)) * (sponsor products on the report! F: F=D2) * (sponsor products on the report! G: G=E2), sponsor products on the report! M: M)
")
ElseIf Cells (6, 16)="RoAS" Then Cells (I, 6)=the Evaluate (" SUMPRODUCT ((sponsor products on the report! A: A=A2) * (sponsor products on the report! C: C=B2) * ISNUMBER (FIND (work platform! $L $6, sponsor products on the report! D: D)) * (sponsor products on the report! F: F=D2) * (sponsor products on the report! G: G=E2), sponsor products on the report! N: N) ")

ElseIf Cells (6, 16)="orders" Then Cells (I, 6)=the Evaluate (" SUMPRODUCT ((sponsor products on the report! A: A=A2) * (sponsor products on the report! C: C=B2) * ISNUMBER (FIND (work platform! $L $6, sponsor products on the report! D: D)) * (sponsor products on the report! F: F=D2) * (sponsor products on the report! G: G=E2), sponsor products on the report! S, S) ")

ElseIf Cells (6, 16)="CR" Then Cells (I, 6)=the Evaluate (" SUMPRODUCT ((sponsor products on the report! A: A=A2) * (sponsor products on the report! C: C=B2) * ISNUMBER (FIND (work platform! $L $6, sponsor products on the report! D: D)) * (sponsor products on the report! F: F=D2) * (sponsor products on the report! G: G=E2), sponsor products on the report! R: R)
")
ElseIf Cells (6, 16)="sales" Then Cells (I, 6)=the Evaluate (" SUMPRODUCT ((sponsor products on the report! A: A=A2) * (sponsor products on the report! C: C=B2) * ISNUMBER (FIND (work platform! $L $6, sponsor products on the report! D: D)) * (sponsor products on the report! F: F=D2) * (sponsor products on the report! G: G=E2), sponsor products on the report! U: U)
")
End the If

The Else

Cells (I, 2)=""

Cells (I, 3)=""

Cells (I, 4)=""

Cells (I, 5)=""

Cells (I, 6)=""

End the If

Next

End Sub

CodePudding user response:

Code is invalid, can't run, very card, your cycle is 1 m from the beginning to the last line, is to a lot of time, or available Worksheet (?) . UsedRange to narrow down the scope of operation,

CodePudding user response:

Card yes your code generation table contains a large number of calculation formula,
The values in the cell, change your automatic calculation formula,
Can automatically calculate at the beginning of the program is closed, at the end of the handle to open the automatic calculation,
  • Related