Home > Software engineering >  All want to head is broken, why can't perform, a great god help quickly.
All want to head is broken, why can't perform, a great god help quickly.

Time:11-13

Fill in the blanks with Sub sampling report ()
A=Sheets (" sheet1 "). [a1]. CurrentRegion. Rows. Count
B=Sheets (" sheet2 "). [a1]. CurrentRegion. Rows. Count
For I=2 To a
For j=2 To b
Dim rData As Range
Set rData=https://bbs.csdn.net/topics/Sheets (" sheet1 ".) Cells (I, 2)
If (Sheet2. Cells (j, 2) Like "*" & amp; RData & amp; "*") Then
Sheet1. Cells (I, 4)=Sheet2. Cells (j, 3)
Sheet1. Cells (I, 5)=Sheet2. Cells (j, 2)
Sheet2. Cells (j, 2). Select
Cells. The Replace I:="rData, Replacement:=" Y "
The Exit For
End the If
Next j
Next I
End Sub

It is this: Cells. The Replace I:="rData," Replacement:="Y" how it is good for you to change?

CodePudding user response:

Cells. The Replace I:="rData", Replacement:="Y", the previous quotes, excess rData is it you find the value of this variable, rather than the string "rData",
In addition, you cannot perform, is normal run the code but didn't get the desired results, or direct error code to run?

CodePudding user response:

Thank you upstairs, I've made a mistake about concept, get rid of the quote, by the way, I again modification, finally, I test very satisfied,
Fill in the blanks with Sub sampling report ()
A=Sheets (" sheet1 "). [a1]. CurrentRegion. Rows. Count
B=Sheets (" sheet2 "). [a1]. CurrentRegion. Rows. Count
For I=2 To a
For j=2 To b
Dim rData As Range
Set rData=https://bbs.csdn.net/topics/Sheets (" sheet1 ".) Cells (I, 2)
If (Sheet2. Cells (j, 2) Like "*" & amp; RData & amp; "*") Then
Sheet1. Cells (I, 4)=Sheet2. Cells (j, 3)
Sheet1. Cells (I, 5)=Sheet2. Cells (j, 4)
Sheet2. Cells (j, 2) Cells. The Replace I:=rData, Replacement:="Y"
The Exit For
End the If
Next j
Next I
End Sub


I had always stuck in this line: Sheet2. Cells (j, 2) Cells. The Replace I:=rData, Replacement:="Y"; The activity I didn't get to the concept of the cell, which is a step in the right,
  • Related