Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ray Ray is offline
external usenet poster
 
Posts: 267
Default If-Then, with an OR --- not working!

Hello -

This piece of code isn't working for me and I have NO idea why not:

iLastRow = ws.Cells(Rows.Count, 2).End(xlUp).Row
If ws.Name < "Home" Or iLastRow < 8 Then
<other code here
End If
Next ws

'ws' is defined as Worksheet and iLastRow is defined as Integer.

So, if the name of the Sheet is 'Home' OR if the LastRow is less than
8, the code should continue on with the next sheet. It works fine if
Sheet.name = Home, but proceeds through the normal code if iLastRow<8
and doing so causes an error.

What's wrong with my coding?

TIA,
Ray

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default If-Then, with an OR --- not working!

If ws.Name < "Home" Or iLastRow 8 Then


--
HTH,
Bernie
MS Excel MVP


"Ray" wrote in message
oups.com...
Hello -

This piece of code isn't working for me and I have NO idea why not:

iLastRow = ws.Cells(Rows.Count, 2).End(xlUp).Row
If ws.Name < "Home" Or iLastRow < 8 Then
<other code here
End If
Next ws

'ws' is defined as Worksheet and iLastRow is defined as Integer.

So, if the name of the Sheet is 'Home' OR if the LastRow is less than
8, the code should continue on with the next sheet. It works fine if
Sheet.name = Home, but proceeds through the normal code if iLastRow<8
and doing so causes an error.

What's wrong with my coding?

TIA,
Ray



  #3   Report Post  
Posted to microsoft.public.excel.programming
Ray Ray is offline
external usenet poster
 
Posts: 267
Default If-Then, with an OR --- not working!

Thanks Bernie ... although now I feel like a fool ... ;)



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 176
Default If-Then, with an OR --- not working!

Ray wrote:
This piece of code isn't working for me and I have NO idea why not:
iLastRow = ws.Cells(Rows.Count, 2).End(xlUp).Row
If ws.Name < "Home" Or iLastRow < 8 Then
<other code here
End If
Next ws
So, if the name of the Sheet is 'Home' OR if the LastRow is less than
8, the code should continue on with the next sheet. It works fine if
Sheet.name = Home, but proceeds through the normal code if iLastRow<8
and doing so causes an error.


1) If ws.Name < "Home" Or iLastRow < 8 Then
2) So, if the name of the Sheet is 'Home' OR
if the LastRow is less than 8

1 doesn't match 2.
is NOT 'Home'?
is = 8?

----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculate working days but change working week SamB Excel Discussion (Misc queries) 1 September 1st 08 09:17 PM
Making weekend days working days - the system cuts the working tim Fluffy Excel Discussion (Misc queries) 1 May 30th 08 10:02 PM
Newly created Get Function is not working when I copied the syntax from a working function CJ Excel Programming 1 January 16th 07 05:28 AM
Macro working in Excel 2003; not working in Excel 2000 Leslie Barberie Excel Programming 5 May 20th 04 07:51 PM
Adding sales from a non working day to the previous working day Alex Excel Programming 1 September 19th 03 08:48 AM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"