Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Formula & Macro


Hello friends
I have a formula in each cell of column L and R.
Example
Formula in cell L6 is =IF(J6<K6,0,1) & Formula in cell R6 is
IF(P6<Q6,0,1)
I was looking for a macro that will give a error message "Warning" i
the value of cells in column L and R is

--
nik_gujarath
-----------------------------------------------------------------------
nik_gujarathi's Profile: http://www.excelforum.com/member.php...fo&userid=3452
View this thread: http://www.excelforum.com/showthread.php?threadid=54603

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,316
Default Formula & Macro

I select the cells in each of the columns (L and R) and name them CheckValues.

The following macro assumes that the sheet in use is Sheet1, change this to
whatever is appropriate to your environment.

Open the VBE (Alt + F11) and in a new module enter the following code:

Sub CheckCells()

Dim rng As Range
Dim wb As Workbook
Dim ws As Worksheet
Dim i As Integer

Set wb = ActiveWorkbook
Set ws = wb.Worksheets("Sheet1")
Set rng = Range("CheckValues")

For i = 1 To rng.Cells.Count
If rng.Cells(i) = 1 Then
MsgBox "A cell in either R or L has evaluated to a 1."
Exit For
End If
Next i

Set rng = Nothing
Set wb = Nothing
Set ws = Nothing

End Sub

Open the worksheet module for whatever sheet the ranges are on and enter the
following in the Worksheet's Change event:

Private Sub Worksheet_Change(ByVal Target As Range)

CheckCells

End Sub

--
Kevin Backmann


"nik_gujarathi" wrote:


Hello friends
I have a formula in each cell of column L and R.
Example
Formula in cell L6 is =IF(J6<K6,0,1) & Formula in cell R6 is =
IF(P6<Q6,0,1)
I was looking for a macro that will give a error message "Warning" if
the value of cells in column L and R is 1


--
nik_gujarathi
------------------------------------------------------------------------
nik_gujarathi's Profile: http://www.excelforum.com/member.php...o&userid=34522
View this thread: http://www.excelforum.com/showthread...hreadid=546036


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
Macro formula help El Bee Excel Worksheet Functions 5 October 20th 08 04:16 PM
Formula or Macro M Hebert Excel Discussion (Misc queries) 2 June 27th 07 01:24 PM
formula in macro Lori Excel Worksheet Functions 6 May 11th 07 02:33 PM
Formula / Macro Help BSLAUTOMATION Excel Discussion (Misc queries) 3 August 31st 05 08:09 PM
Formula in macro help Biff Excel Programming 10 August 13th 05 06:13 AM


All times are GMT +1. The time now is 02:33 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"