TheRedCardinal
Board Regular
- Joined
- Jul 11, 2019
- Messages
- 243
- Office Version
- 365
- 2021
- Platform
- Windows
Hi all,
I need to find the highest x values in a range on a spreadsheet. They are contained in a range in column F of a sheet called "Temp", which has been assigned variable WS4.
My code looks like this:
The purpose is to load the details into the Array VATSalesCheck of whatever value is in the cell called "VATSalesCheck" on WS3. (Currently 5)
But in the above IF statement, I never get a TRUE result, even though when stepping through, the CellA.Value popup value matches the ones on the sheet that have been highlighted by the conditional formatting of top 5 values.
Can anybody see what I've done wrong?
I need to find the highest x values in a range on a spreadsheet. They are contained in a range in column F of a sheet called "Temp", which has been assigned variable WS4.
My code looks like this:
VBA Code:
For Each CellA In Range(WS4.Cells(1, 6), WS4.Cells(b, 6))
If CellA.Value = WorksheetFunction.Large(WS4.Range(WS4.Cells(1, 6), WS4.Cells(b, 6)), WS3.Range("VATSalesCheck")) Then
z = z + 1
y = CellA.Row
For Counter = 1 To 6
VatSalesCheck(z, Counter) = VATSales(y, Counter)
Next Counter
End If
Next CellA
The purpose is to load the details into the Array VATSalesCheck of whatever value is in the cell called "VATSalesCheck" on WS3. (Currently 5)
But in the above IF statement, I never get a TRUE result, even though when stepping through, the CellA.Value popup value matches the ones on the sheet that have been highlighted by the conditional formatting of top 5 values.
Can anybody see what I've done wrong?