ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Structure of If...Else in VBA (https://www.excelbanter.com/excel-programming/273015-re-structure-if-else-vba.html)

John Wilson

Structure of If...Else in VBA
 
Sheela,

If the following example doesn't help, please post an example of your
code:

This works for me:

If cMan1 = cMan2 And cMan1 = cMan3 And cMod1 = cMod2 And cMod1 = cMod3
Then
' do something
Else
' do something
End If

Sheela wrote:

Hello,

I have a situation here. When I break up an if..else
statement in the excel worksheet, as in A < B < C to AND
(A<B;B<C), it works but when I convert to VBA as in "If
(A<B) And (B<C) Then" it does not work. I realized it
makes a difference when I break up the condition in
worksheet but how do I go about doing it in VBA?

Thanks for your help.

Sheela



sheela

Structure of If...Else in VBA
 
I must attach the excel VBA for the coding is long. I can
tell you the problem I'm facing by referring to the excel
userform. Can I send to your email address instead of
using the newsgroup forum?

Thanks,

sheela
-----Original Message-----
Sheela,

If the following example doesn't help, please post an

example of your
code:

This works for me:

If cMan1 = cMan2 And cMan1 = cMan3 And cMod1 = cMod2 And

cMod1 = cMod3
Then
' do something
Else
' do something
End If

Sheela wrote:

Hello,

I have a situation here. When I break up an if..else
statement in the excel worksheet, as in A < B < C to

AND
(A<B;B<C), it works but when I convert to VBA as in "If
(A<B) And (B<C) Then" it does not work. I realized it
makes a difference when I break up the condition in
worksheet but how do I go about doing it in VBA?

Thanks for your help.

Sheela


.


John Wilson

Structure of If...Else in VBA
 
Sheela,

My e-mail address isn't encrypted.
It's the same one that I post messages with.



John

Sheela wrote:

I must attach the excel VBA for the coding is long. I can
tell you the problem I'm facing by referring to the excel
userform. Can I send to your email address instead of
using the newsgroup forum?

Thanks,

sheela
-----Original Message-----
Sheela,

If the following example doesn't help, please post an

example of your
code:

This works for me:

If cMan1 = cMan2 And cMan1 = cMan3 And cMod1 = cMod2 And

cMod1 = cMod3
Then
' do something
Else
' do something
End If

Sheela wrote:

Hello,

I have a situation here. When I break up an if..else
statement in the excel worksheet, as in A < B < C to

AND
(A<B;B<C), it works but when I convert to VBA as in "If
(A<B) And (B<C) Then" it does not work. I realized it
makes a difference when I break up the condition in
worksheet but how do I go about doing it in VBA?

Thanks for your help.

Sheela


.




All times are GMT +1. The time now is 04:53 PM.

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