Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
N+ N+ is offline
external usenet poster
 
Posts: 34
Default and, or in vbe

hi all !! how can i do the AND , OR function of worksheet
in the vbe ??
ty for helping !!
paolo
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default and, or in vbe

A bit more explanation as to what you are doing and what you have tried.


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"N+" wrote in message
...
hi all !! how can i do the AND , OR function of worksheet
in the vbe ??
ty for helping !!
paolo


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default and, or in vbe

In VB, And and Or are not functions, they are operators... you would use
them in much the same way as you would use plus, minus, multiply, etc. For
example...

If (A 4) And (B <= 10) Then

Rick


"N+" wrote in message
...
hi all !! how can i do the AND , OR function of worksheet
in the vbe ??
ty for helping !!
paolo


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default and, or in vbe

I'm not sure what you're asking. VBA has its own 'And' and 'Or' comparison
operators. If you want to use the worksheet function, you can do something
like

Application.WorksheetFunction.Or

If you want to create a formula in a cell, try something like

Dim F As String
F = "=OR(A1,B1)"
Range("C1").Formula = F


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



"N+" wrote in message
...
hi all !! how can i do the AND , OR function of worksheet
in the vbe ??
ty for helping !!
paolo


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 421
Default and, or in vbe

Hi Paolo,

Perhaps the following procedure will
be of assistance:

'===========
Public Sub Tester()
Dim Rng As Range
Dim rng2 As Range

With ActiveSheet
Set Rng = .Range("A1")
Set rng2 = .Range("A2")
End With

Rng.Value = 10
rng2 = 20

If Rng = 10 _
And rng2 = 10 Then
MsgBox Prompt:="Both = 9"
End If

If Rng = 10 _
Or rng2 = 10 Then
MsgBox Prompt:="At least one value = 10"
End If

End Sub
'<<===========



---
Regards.
Norman


"N+" wrote in message
...
hi all !! how can i do the AND , OR function of worksheet
in the vbe ??
ty for helping !!
paolo




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default and, or in vbe

AND and OR are operators in VBA, not functions in the worksheet:

Sub and_or()
If Range("A1").Value = 1 And Range("A2").Value = 1 Then
MsgBox ("Both are one")
End If

If Range("A1").Value = 1 Or Range("A2").Value = 1 Then
MsgBox ("At least one is one")
End If

End Sub

--
Gary''s Student - gsnu200783


"N+" wrote:

hi all !! how can i do the AND , OR function of worksheet
in the vbe ??
ty for helping !!
paolo

  #7   Report Post  
Posted to microsoft.public.excel.programming
N+ N+ is offline
external usenet poster
 
Posts: 34
Default and, or in vbe



'''''''''''DONE TY !!'''''''''''''''

"Gary''s Student" wrote:

AND and OR are operators in VBA, not functions in the worksheet:

Sub and_or()
If Range("A1").Value = 1 And Range("A2").Value = 1 Then
MsgBox ("Both are one")
End If

If Range("A1").Value = 1 Or Range("A2").Value = 1 Then
MsgBox ("At least one is one")
End If

End Sub

--
Gary''s Student - gsnu200783


"N+" wrote:

hi all !! how can i do the AND , OR function of worksheet
in the vbe ??
ty for helping !!
paolo

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default and, or in vbe

Set rng = Selection
For Each cell In rng
If cell.Text = "0" Or cell.Text = "" And _
cell.Offset(0, 3).Value = "hoohah" Then
cell.EntireRow.Interior.ColorIndex = 6
End If
Next


Gord Dibben MS Excel MVP

On Sat, 3 May 2008 11:15:00 -0700, N+ wrote:

hi all !! how can i do the AND , OR function of worksheet
in the vbe ??
ty for helping !!
paolo


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



All times are GMT +1. The time now is 11:45 PM.

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

About Us

"It's about Microsoft Excel"