Thanks for reading this anyway. Here's my problem: I have a list of courses on a sheet and i'm using them as reference to count how many times this courses will appear in one year. But i can't set my variable to get one of this courses at a time. Here's the code:
lr = ws.Cells(1, 1).End(xlDown).Row
ReDim x(lr - 1)
For i = 1 To (lr - 1)
k = ws.Range(Cells(1 + i, 1), Cells(1 + i, 1)).Text
For Each sheets In wb.sheets
With sheets.Range("A1:J86")
Set rng = .Find(k, sheets.Cells(1), xlValues, xlWhole, xlByRows, xlPrevious, False)
If Not rng Is Nothing Then
v = v + 1
End If
End With
Next sheets
x(i) = (v - 1)
v = 0
Next
Thanks for your time.
You don't need Range(Cells(), Cells())
for only one cell:
k = ws.Cells(1 + i, 1).Text
will suffice.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.