LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default ElseIf question

I am trying to write code so that when an entry is made, excel verifies
necessary entries in other ranges before saving the change. I started with
code that worked:

If Not Application.Intersect(Target, Me.Range("O3")) Is Nothing Then

If IsNumeric(Target) Then

If Not Application.WorksheetFunction.CountA(Range("Filler Scrap")) 0 Then

Dim FScrapButton As Integer

intFScrapButton = MsgBox("Please Enter Scrap!", vbOKOnly +
vbExclamation, "Filler Scrap!")

Range("O3:P4").Select

Selection.ClearContents

Range("C29").Select

ElseIf Not Application.WorksheetFunction.CountA(Range("C40:C4 6")) 0 Then

Dim LaborButton As Integer

intLaborButton = MsgBox("Please Enter Labor!", vbOKOnly +
vbExclamation, "Labor!")

Range("O3:P4").Select

Selection.ClearContents

Range("C40").Select

Else

Me.Parent.Save

Dim intButtonPressed As Integer

intButtonPressed = MsgBox("Your Tracking Sheet has been Saved. Would
you like to Print?", vbYesNo + vbQuestion)

If intButtonPressed = vbYes Then

ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True

But when I add another "ElseIF" statement after the first, excel completely
ignores the ElseIF statements and goes directly to Else statement.

Is there a limit to how many "ElseIF" functions I can use?
 
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
Elseif? ibrokit Excel Worksheet Functions 5 November 25th 08 04:28 PM
A beginners Elseif question Cerberus Excel Programming 3 July 22nd 08 03:19 PM
elseif Curt Excel Programming 0 March 28th 07 01:13 AM
ElseIf tom1646 Excel Programming 4 October 19th 04 02:09 PM
If...Elseif...End If javab98 Excel Programming 2 July 19th 04 07:23 PM


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