ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   I'm only getting 0 (https://www.excelbanter.com/excel-programming/351172-im-only-getting-0-a.html)

Observer

I'm only getting 0
 
Hiya,

I have the following VB rules, always worked until this year.
The result is that I'm now getting only 0 and not anymore the week numbers:

Can someone advice me what could be wrong?

Cheers
------------------------------
Sub remainderUpdateWeeks()

Dim repWeek(2, 155)
Dim firstDate As Date
Dim lastDate As Date
Dim data(4, 30000)
Dim noOfItems
Dim currentSheet
Dim reminderBook

Application.ScreenUpdating = False

currentSheet = ActiveSheet.Name
reminderBook = ActiveWorkbook.Name

Workbooks("ESS makro book.xls").Activate
Sheets("weeks").Activate

For i = 0 To 155
repWeek(0, i) = Range("A2").Offset(i, 0)
repWeek(1, i) = Range("B2").Offset(i, 0)
repWeek(2, i) = Range("C2").Offset(i, 0)
Next

Workbooks(reminderBook).Activate
Sheets(currentSheet).Activate

For i = 1 To 30000
If Range("B4").Offset(i, 0) = "" Then Exit For
data(1, i) = Range("B4").Offset(i, 0) 'Received date
noOfItems = noOfItems + 1
Next

noOfItems = noOfItems - 1

For i = 0 To noOfItems
For t = 0 To 155
If data(1, i) = repWeek(1, t) And data(1, i) <= repWeek(2, t)
Then
data(0, i) = repWeek(0, t)
Exit For
Else
data(0, i) = 0
End If
Next
Next

For i = 0 To noOfItems
Range("A4").Offset(i, 0) = data(0, i)
Next

Application.ScreenUpdating = True

End Sub


All times are GMT +1. The time now is 05:43 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com