![]() |
and, or in vbe
hi all !! how can i do the AND , OR function of worksheet
in the vbe ?? ty for helping !! paolo |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
All times are GMT +1. The time now is 04:33 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com