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/312381-check-variance-code-not-working.html)

goss[_35_]

Check variance code not working
 

Hi ng
Using xl 2003

Some code below Tom Ogilvy is helping me with
The third line is red when I paste into VBE
The .Range... does seem strange to me, but I'm no expert

Can anyone point out what may be causing the error?
compile error
expected list separator or )

TIA
-goss



Sub Check_Next()
with worksheets("Accnt_Compare")
set rng = .Range(.Cells(2,"O"),.Cells(rows.count,"O").end(xl up)
for each cell in rng
.Range("M12").Value = cell.Value ' M12 or M2?
Application.Calculate
If Val(.Cells(23, 8)) 19.99 Then
Call Print_Job
End if
Next
end with
end Sub

--
Regards,
Tom Ogilv

--
gos

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


K Dales

Check variance code not working
 
The code itself seems OK, I think it is just a typo. You
are misssing a closing ")" somewhere. If you count
the "("s you will see you have one more than the ")"s.

I think this is what you want:

set rng = .Range(.Cells(2,"O"),.Cells(rows.count,"O")).end
(xlup)


-----Original Message-----

Hi ng
Using xl 2003

Some code below Tom Ogilvy is helping me with
The third line is red when I paste into VBE
The .Range... does seem strange to me, but I'm no expert

Can anyone point out what may be causing the error?
compile error
expected list separator or )

TIA
-goss



Sub Check_Next()
with worksheets("Accnt_Compare")
set rng = .Range(.Cells(2,"O"),.Cells(rows.count,"O").end

(xlup)
for each cell in rng
.Range("M12").Value = cell.Value ' M12 or M2?
Application.Calculate
If Val(.Cells(23, 8)) 19.99 Then
Call Print_Job
End if
Next
end with
end Sub

--
Regards,
Tom Ogilvy


--
goss


----------------------------------------------------------

--------------
goss's Profile: http://www.excelforum.com/member.php?

action=getinfo&userid=4602
View this thread:

http://www.excelforum.com/showthread...hreadid=265174

.


Tom Ogilvy

Check variance code not working
 
Actually it should be;

set rng = .Range(.Cells(2,"O"),.Cells(rows.count,"O").end(xl up))

--
Regards,
Tom Ogilvy


"K Dales" wrote in message
...
The code itself seems OK, I think it is just a typo. You
are misssing a closing ")" somewhere. If you count
the "("s you will see you have one more than the ")"s.

I think this is what you want:

set rng = .Range(.Cells(2,"O"),.Cells(rows.count,"O")).end
(xlup)


-----Original Message-----

Hi ng
Using xl 2003

Some code below Tom Ogilvy is helping me with
The third line is red when I paste into VBE
The .Range... does seem strange to me, but I'm no expert

Can anyone point out what may be causing the error?
compile error
expected list separator or )

TIA
-goss



Sub Check_Next()
with worksheets("Accnt_Compare")
set rng = .Range(.Cells(2,"O"),.Cells(rows.count,"O").end

(xlup)
for each cell in rng
.Range("M12").Value = cell.Value ' M12 or M2?
Application.Calculate
If Val(.Cells(23, 8)) 19.99 Then
Call Print_Job
End if
Next
end with
end Sub

--
Regards,
Tom Ogilvy


--
goss


----------------------------------------------------------

--------------
goss's Profile: http://www.excelforum.com/member.php?

action=getinfo&userid=4602
View this thread:

http://www.excelforum.com/showthread...hreadid=265174

.





All times are GMT +1. The time now is 07:20 PM.

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