Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 22
Send a message via Skype™ to Bakar
Question Macros replace if arguments

Hi Everyone
can someone help please
let say I have in Sheet 1 in cells CW 24 =yes,CW 25 =yes,CW 26 =yes,CW 27 =yes,CW 28 =yes
If all thes cells are yes I want a macro to give me a message box "Successfully completed!"

Thnxs for your valuable help
Bakar

Last edited by Bakar : October 18th 12 at 01:52 PM Reason: Solved
  #2   Report Post  
Member
 
Location: Bangalore
Posts: 41
Default

Quote:
Originally Posted by Bakar View Post
Hi Everyone
can someone help please
let say I have in Sheet 1 in cells CW 24 =yes,CW 25 =yes,CW 26 =yes,CW 27 =yes,CW 28 =yes
If all thes cells are yes I want a macro to give me a message box "Successfully completed!"

Thnxs for your valuable help
Bakar
Hi,

Try this code.

Sub Check()
Dim Rng As Range
Set Rng = Range("CW24:CW28")
If Application.WorksheetFunction.CountIf(Rng, "<Yes") = 0 Then
MsgBox "All cells contain YES", vbInformation
Else
MsgBox "One of the cells doesn't contain YES", vbInformation
End If
End Sub

Just a suggestion. You should try to give the range a meaningful name such as SearchRange or something. Also, are you going to run this macro on your own or should it run with an event such as changing the CW24:CW28 range?

I hope this helps you.

Prashant
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 536
Default Macros replace if arguments

On Wednesday, October 17, 2012 8:59:04 AM UTC-7, Bakar wrote:
Hi Everyone

can someone help please

let say I have in Sheet 1 in cells CW 24 =yes,CW 25 =yes,CW 26 =yes,CW

27 =yes,CW 28 =yes

If all thes cells are yes I want a macro to give me a message box

"Successfully completed!"



Thnxs for your valuable help

Bakar









--

Bakar


Hi Bakar,
Try this, meanwhile I will try to do it with a macro as you asked.

=IF(COUNTIF(CW24:CW28,"yes")=5,"S-C","")

Regards,
Howard
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 536
Default Macros replace if arguments

On Wednesday, October 17, 2012 8:59:04 AM UTC-7, Bakar wrote:
Hi Everyone

can someone help please

let say I have in Sheet 1 in cells CW 24 =yes,CW 25 =yes,CW 26 =yes,CW

27 =yes,CW 28 =yes

If all thes cells are yes I want a macro to give me a message box

"Successfully completed!"



Thnxs for your valuable help

Bakar









--

Bakar


Here is a message box code:

Private Sub Worksheet_Change(ByVal Target As Range)
If Application.WorksheetFunction.CountIf(Range("CW24: CW28"), "yes") = 5 Then
MsgBox "Successfully completed!", vbOKOnly, "Get'er Done"
End If
End Sub
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
Conditional Replace without macros Craig Excel Worksheet Functions 2 May 20th 09 11:34 PM
PASSING MACROS WITH ARGUMENTS FROM OTHER FILES TO BE RUN [email protected] Excel Programming 4 August 21st 06 06:35 PM
macros using find/replace TB Excel Programming 1 June 14th 06 11:43 AM
Macros & search /replace Anthony Excel Worksheet Functions 2 February 12th 06 10:54 PM
Calling macros width arguments in winxp Isidro Vila Verde Excel Programming 2 October 31st 03 03:55 PM


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