Home > Software engineering >  Urgent ~ can you tell me the Excel VBA in how to make the cells in a certain range to give a specifi
Urgent ~ can you tell me the Excel VBA in how to make the cells in a certain range to give a specifi

Time:09-23

Calculate gpa, 90 -- 100 partition for 4.5 and then multiplied by 4.5 credits
I can't write to

 Private Sub CommandButton1_Click () 
For I=Cells (6, 2) To Cells (7, 2)
Cells (I, Cells (8, 2))=0
Next I

For I=Cells (6, 2) To Cells (7, 2)
For j=Cells (9, 2) To Cells (10, 2)
If IsNumeric (Cells (I, j)=True Then If Cells (I, j) & gt;=90 & amp; & Cells (I, j) & lt;=100 Then Cells (I, Cells (8, 2))=Cells (I, Cells (8, 2)) + Cells (Cells (11, 2), j). The Value=https://bbs.csdn.net/topics/4.5
If IsNumeric (Cells (I, j)=True Then If Cells (I, j) & gt;=80 & amp; & Cells (I, j) & lt; Then 90 Cells (I, Cells (8, 2))=Cells (I, Cells (8, 2)) + Cells (Cells (11, 2), j). The Value=https://bbs.csdn.net/topics/3.5
If IsNumeric (Cells (I, j)=True Then If Cells (I, j) & gt;=70 & amp; & Cells (I, j) & lt; Then 80 Cells (I, Cells (8, 2))=Cells (I, Cells (8, 2)) + Cells (Cells (11, 2), j). The Value=https://bbs.csdn.net/topics/2.5
If IsNumeric (Cells (I, j)=True Then If Cells (I, j) & gt;=60 & amp; & Cells (I, j) & lt; Then 70 Cells (I, Cells (8, 2))=Cells (I, Cells (8, 2)) + Cells (Cells (11, 2), j). The Value=https://bbs.csdn.net/topics/1.5
If IsNumeric (Cells (I, j)=True Then If Cells (I, j) & gt;=0 & amp; & Cells (I, j) & lt; 60 Then Cells (I, Cells (8, 2))=Cells (I, Cells (8, 2)) + Cells (Cells (11, 2), j). The Value=https://bbs.csdn.net/topics/0

If IsNumeric (Cells (I, j)=False Then the If Cells (I, j)="failed" Then Cells (I, Cells (8, 2))=Cells (I, Cells (8, 2)) + Cells (Cells (11, 2), j). The Value=https://bbs.csdn.net/topics/0
If IsNumeric (Cells (I, j)=False Then the If Cells (I, j)="pass" Then Cells (I, Cells (8, 2))=Cells (I, Cells (8, 2)) + Cells (Cells (11, 2), j). The Value=https://bbs.csdn.net/topics/1.5
If IsNumeric (Cells (I, j)=False Then the If Cells (I, j)="in" Then Cells (I, Cells (8, 2))=Cells (I, Cells (8, 2)) + Cells (Cells (11, 2), j). The Value=https://bbs.csdn.net/topics/2.5
If IsNumeric (Cells (I, j)=False Then the If Cells (I, j)="good" Then Cells (I, Cells (8, 2))=Cells (I, Cells (8, 2)) + Cells (Cells (11, 2), j). The Value=https://bbs.csdn.net/topics/3.5
If IsNumeric (Cells (I, j)=False Then the If Cells (I, j)="optimal" Then Cells (I, Cells (8, 2))=Cells (I, Cells (8, 2)) + Cells (Cells (11, 2), j). The Value=https://bbs.csdn.net/topics/4.5
Next j
Next I
End Sub

CodePudding user response:

Began keeping records in Excel macro, manual, complete the required function end record macros, press Alt + F11 key, check just record macro corresponding VBA code,

CodePudding user response:

Please refer to:
 sub test 
Dim Rngs as range, Rng as range
The set RNGS=sheet1. Range (" a3: h33 ") "'
For each RNG RNGS in
The select case val (RNG) value)
Case 90 to 100
RNG. Offset (0, 1). The value=https://bbs.csdn.net/topics/4.5 * credits' ' ' 'behind a list of corresponding position
In case the else
Value
select case RNG.Case "qualified"
Case "fail"
Case "good"
End the select

End the select
Next
End sub
  •  Tags:  
  • VBA
  • Related