ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Check variance code not working (https://www.excelbanter.com/excel-programming/312059-check-variance-code-not-working.html)

goss[_33_]

Check variance code not working
 

Hi ng.
Using xl 2003.

I have sheet that uses vlookups and formulas to determin variance
between 2 sets of data for a given list of accounts

Accounts fluctuate and start at O2 going down
As go down list, new account should update to M2
C2:C21 are linked to $M$2 to get account number to perform lookups

Not working:
The account number is not updating in Col C Probably not updating at M
either
For all I know loop is next executing casuing cell reference to go dow
list
'til 0 val found.

Appreciate any help
TIA goss

my code:

Sub Check_Next()

Dim i As Double
Dim x As Integer

Application.ScreenUpdating = False
ActiveWorkbook.Worksheets("Accnt_Compare").Activat e
Range("O2").Activate

x = 0
i = 0
i = ActiveCell.Value

Do While i < 0
If ActiveCell.Value = 0 Then
Exit Sub
Else
If Val(Cells(23, 8)) 19.99 Then
Call Print_Job
Else
x = x + 1
Range("O2").Activate
ActiveCell.Offset(x, 0).Select
i = ActiveCell.Value
Cells(2, 12) = ActiveCell.Value
Application.Calculate
End If
End If
Loop
Application.ScreenUpdating = True

End Su

--
gos

-----------------------------------------------------------------------
goss's Profile: http://www.excelforum.com/member.php...nfo&userid=460
View this thread: http://www.excelforum.com/showthread.php?threadid=26517


Tom Ogilvy

Check variance code not working
 
Sub Check_Next()

Dim i As Double
Dim x As Integer
Dim rng as Range
Application.ScreenUpdating = False
ActiveWorkbook.Worksheets("Accnt_Compare").Activat e
Range("O2").Activate
set rng = Range("O2")
x = 0
i = 0
i = ActiveCell.Value

Do While i < 0
If rng.Value = 0 Then
Exit Sub
Else
If Val(Cells(23, 8)) 19.99 Then
Call Print_Job
Else
x = x + 1
set rng = Range("O2").Offset(x,0)
i = rng.Value
Cells(rng.row, 12) = i
Application.Calculate
End If
End If
Loop
Application.ScreenUpdating = True

End Sub

--
Regards,
Tom Ogilvy

"goss" wrote in message
...

Hi ng.
Using xl 2003.

I have sheet that uses vlookups and formulas to determin variances
between 2 sets of data for a given list of accounts

Accounts fluctuate and start at O2 going down
As go down list, new account should update to M2
C2:C21 are linked to $M$2 to get account number to perform lookups

Not working:
The account number is not updating in Col C Probably not updating at M2
either
For all I know loop is next executing casuing cell reference to go down
list
'til 0 val found.

Appreciate any help
TIA goss

my code:

Sub Check_Next()

Dim i As Double
Dim x As Integer

Application.ScreenUpdating = False
ActiveWorkbook.Worksheets("Accnt_Compare").Activat e
Range("O2").Activate

x = 0
i = 0
i = ActiveCell.Value

Do While i < 0
If ActiveCell.Value = 0 Then
Exit Sub
Else
If Val(Cells(23, 8)) 19.99 Then
Call Print_Job
Else
x = x + 1
Range("O2").Activate
ActiveCell.Offset(x, 0).Select
i = ActiveCell.Value
Cells(2, 12) = ActiveCell.Value
Application.Calculate
End If
End If
Loop
Application.ScreenUpdating = True

End Sub


--
goss


------------------------------------------------------------------------
goss's Profile:

http://www.excelforum.com/member.php...fo&userid=4602
View this thread: http://www.excelforum.com/showthread...hreadid=265174





All times are GMT +1. The time now is 05:31 PM.

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