Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default trying to build in a check

Hi

This code works fine, but I'm sure it can be done more easy! Can
somebody help me out?

Sub start()
If Worksheets("atm").Range("C4").Value < "Plan.r." Then
MsgBox " check again",true
Exit Sub
End If
If Worksheets("atm").Range("D4").Value < "Inv.rg." Then
MsgBox "check again", true
Exit Sub
End If
If Worksheets("atm").Range("H4").Value < "type" Then
MsgBox "check again", true
Exit Sub
End If
etc...
etc....

Call AE_1B2

End Sub

Thanks in advance.

Bernd
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default trying to build in a check

One way:

Option Explicit
Sub StartIt()

Dim myCell As Range

Set myCell = Worksheets("ATM").Range("C4")

Select Case LCase(myCell.Value)
Case Is = LCase("plan.r"), LCase("inv.rg."), LCase("type")
MsgBox "Check again"
Exit Sub
End Select

MsgBox "other stuff here"

End Sub


bernd wrote:

Hi

This code works fine, but I'm sure it can be done more easy! Can
somebody help me out?

Sub start()
If Worksheets("atm").Range("C4").Value < "Plan.r." Then
MsgBox " check again",true
Exit Sub
End If
If Worksheets("atm").Range("D4").Value < "Inv.rg." Then
MsgBox "check again", true
Exit Sub
End If
If Worksheets("atm").Range("H4").Value < "type" Then
MsgBox "check again", true
Exit Sub
End If
etc...
etc....

Call AE_1B2

End Sub

Thanks in advance.

Bernd


--

Dave Peterson
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
Build workbook by xml Nay Excel Programming 1 May 28th 07 10:12 PM
Build Formula lynnc Excel Worksheet Functions 4 February 13th 06 11:24 PM
How to build build a macro that automatically imports PedroPeso Excel Programming 1 December 26th 03 08:14 PM
Build a Macro Dale Avison Excel Programming 2 September 28th 03 05:51 PM
Build Add-in in C++ Bura Tino Excel Programming 2 September 28th 03 03:34 AM


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