I have one excel file as attached… I want to check the contain Column A of Sheet Name " input(dosmetic) " , if the contain include some keyword same with Sheet Name " Defect code " then it will write the " 1 " number into the B column of Sheet " include(dosmetic) "
But problem is the excel has many row, it can not run and I must wait very long time and then close process… when I delete many row, it can run normally.
Hi @trunghai,
It is normal that it will run longer than expected because it has many rows.
If you really want a faster process (very fast), you may want to try working with macros (VBA).
Thank you!
I have write a VBA code as below. How to use Invoke VBA in this case ?
Dim sArr(), dArr(), Rws As Long, I As Long, K As Long, R As Long, Txt, Txt1 As String
Dim a As Integer
Range(“B2”).Resize(10000).ClearContents
For a = 2 To 100
Rws = Range(“A1000000”).End(xlUp).Row
If Rws = 1 Then Exit Sub
Txt = UCase(Sheet14.Cells(a, 2))
''a = a + 1
sArr = Range(“A1:A” & Rws).Value
R = UBound(sArr)
ReDim dArr(1 To R, 1 To 1)
For I = 2 To R
If Txt <> “” Then
If UCase(sArr(I, 1)) Like “" & Txt & "” Then
Sheet1.Cells(I, 2) = “1”
End If
End If
Next I
Next a
Hi @trunghai.
Please check this zip file: Hado2.zip (172.1 KB)
It has vba.txt file.
It seems that your vba is not working. I tried changing value for a cell and it worked.
So please revise the VBA code that is inside vba.txt.
Thank you