Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 394
Default ERROR Checking Before Running Program

Hi everyone,

I need to be able to check whether the data entered is the actaul data
that needs to be processed.
The program I have works GREAT so it is just a case of fine tuning the
criteria to use.
I would like to do the following please.
So far I have ...

Code:-
Set rngA = Worksheets("A").Range("B2").UsedRange.Rows
Set rngB = Worksheets("A").Range("B4").UsedRange.Rows

.... and would like to ADD the following, I know Numbers 1 AND 3 will
use vbYesNo and Numbers 2 AND 4 will use vbYesNoCacel :-

Number 1
--------------
If rngA is NOTHING Then
MsgBox = "Text goes here"
If YES goto rngA and Exit Sub
If NO Exit Sub

Number 2
--------------
If rngA is NOT NOTHING Then
MsgBox "Text goes here"
If YES continue running the program
If NO goto rngA and Exit Sub
If CANCEL Exit Sub

Number 3
--------------
If rngB is NOTHING Then
MsgBox = "Text goes here"
If YES goto rngB and Exit Sub
If NO Exit Sub

Number 4
--------------
If rngB is NOT NOTHING Then
MsgBox "Text goes here"
If YES continue running the program
If NO goto rngB and Exit Sub
If CANCEL Exit Sub

Number 5
--------------
If Number 2 AND Number 4 = YES Then
On Error Resume Next
Worksheets("B").Delete
On Error GoTo 0
Worksheets.Add(After:=Worksheets("A")).Name = "B"
Cells.Font.Name = "Tahoma"

The actual program then starts here.

P = Application.Max(rngB)
etc
etc
etc

Thanks in Advance.
All the Best.
Paul

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default ERROR Checking Before Running Program

Paul

I think you want something like the following:

If rnA.cells.count=0 then
Ans=Msgbox("Text goes here",vbYesNoCancel)
If Ans=vbYes then
rngA.select
else
exit sub
end if
else .....

"Paul Black" wrote:

Hi everyone,

I need to be able to check whether the data entered is the actaul data
that needs to be processed.
The program I have works GREAT so it is just a case of fine tuning the
criteria to use.
I would like to do the following please.
So far I have ...

Code:-
Set rngA = Worksheets("A").Range("B2").UsedRange.Rows
Set rngB = Worksheets("A").Range("B4").UsedRange.Rows

.... and would like to ADD the following, I know Numbers 1 AND 3 will
use vbYesNo and Numbers 2 AND 4 will use vbYesNoCacel :-

Number 1
--------------
If rngA is NOTHING Then
MsgBox = "Text goes here"
If YES goto rngA and Exit Sub
If NO Exit Sub

Number 2
--------------
If rngA is NOT NOTHING Then
MsgBox "Text goes here"
If YES continue running the program
If NO goto rngA and Exit Sub
If CANCEL Exit Sub

Number 3
--------------
If rngB is NOTHING Then
MsgBox = "Text goes here"
If YES goto rngB and Exit Sub
If NO Exit Sub

Number 4
--------------
If rngB is NOT NOTHING Then
MsgBox "Text goes here"
If YES continue running the program
If NO goto rngB and Exit Sub
If CANCEL Exit Sub

Number 5
--------------
If Number 2 AND Number 4 = YES Then
On Error Resume Next
Worksheets("B").Delete
On Error GoTo 0
Worksheets.Add(After:=Worksheets("A")).Name = "B"
Cells.Font.Name = "Tahoma"

The actual program then starts here.

P = Application.Max(rngB)
etc
etc
etc

Thanks in Advance.
All the Best.
Paul


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
running program from userform davegb Excel Programming 10 November 2nd 06 04:57 PM
Running program Greg[_32_] Excel Programming 1 October 24th 06 05:43 AM
checking for a running app L3Tech Excel Programming 1 January 19th 06 01:01 AM
Vba - Checking if running ajliaks[_39_] Excel Programming 2 September 11th 04 06:09 PM
Running Program on a Mac ibeetb Excel Programming 0 October 16th 03 01:47 PM


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