Wrox Programmer Forums
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 21st, 2004, 10:34 AM
Authorized User
 
Join Date: May 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default help with Msgbox

i did conditional formatting that if a cell value is <=2 change the color to purpel,
then after that did writ a code that makes a Msgbox appears as a wornning followed by another
Msgbox that give the exact addrress of the cell that contain <=2.....

i tried to with this code, but it did not work........
any hints is appreciated.............


Private Sub Worksheet_Change(ByVal Target As Range)
Dim c As Range
'Dim myCheck As Integer

For Each c In Sheet3.Range("E32:E1800").Cells
If c.Interior.ColorIndex <> -4142 Then
    If c.Value <= 2 Then
       c.Interior.ColorIndex = 3
 MsgBox """?C????I ??I ???C? C??I??? ???E ?E? ", vbOKOnly, " Warnning"
 MsgBox c.Address
    End If
End If
Next
End Sub

yours
hesham



 
Old June 25th, 2004, 06:40 AM
Registered User
 
Join Date: Jun 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm short on time but :

Sheet3.Range(.......) doesn't look right. Try Worksheets("Sheet3").Range(..........

And .cells shouldn't be needed.

Alf

 
Old June 25th, 2004, 08:24 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 132
Thanks: 0
Thanked 0 Times in 0 Posts
Default

OK, Sheet3 is the default object name of worksheets("Sheet 3"), it can be changed to whatever you want from the Properties pane in the VBE. And although .Cells is not necessary, it is a good idea now to start explicitly stating the default value/object of objects as a way of easing the move to VBA.NET when it happens (.NET does not have a default attribute, everything must be specified)

hesham, I think you have your first If condition backwards.


Chris

There are two secrets to success in this world:
1. Never tell everything you know





Similar Threads
Thread Thread Starter Forum Replies Last Post
Msgbox rwalker ASP.NET 1.x and 2.0 Application Design 28 March 20th, 2008 01:23 PM
Msgbox Help darrenb Access VBA 2 June 8th, 2007 12:53 AM
MsgBox prabodh_mishra Pro VB 6 1 December 29th, 2006 11:51 AM
msgbox Ramakrishna.G General .NET 3 September 14th, 2004 02:17 AM
msgbox bph Access VBA 2 February 6th, 2004 03:00 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.