Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default If,Then,Else Macro

Dear Experts
I have an Auto_Open Macro using the If, Then, Else statement for each time I
open the spreadsheet it gives me the msgbox of percent completed. Here is
what I have so far and it works with one problem. If Range ("Schedule!L1") =0
or is blank I get the Debug window upon opening the spreadsheet. How do I
write this macro to tell Auto_open to ignore L1 cell if it is less then 0, or
= to 0 or is blank?
Cell L1 is formatted for percentage.
Sub Auto_Open()
Dim Value1 As Integer
Dim Value2 As Integer
If Range("Schedule!L1") 0 Then
Value1 = Worksheets("Schedule").Range("L1") * 100
Value2 = Worksheets("Schedule").Range("M1") * 100
MsgBox "YOUR JOB IS " & (Value1) & " % " & "DETAILED" & " AND " & (Value2) &
" % " & "SHIPPED", vbInformation, "PERCENT COMPLETE"
End If
End Sub
--
He4Giv (Dick)
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default If,Then,Else Macro

Sub Auto_Open()
Dim Value1 As Integer
Dim Value2 As Integer
If Range("Schedule!L1") 0 Then
Value1 = Worksheets("Schedule").Range("L1") * 100
Value2 = Worksheets("Schedule").Range("M1") * 100
MsgBox "YOUR JOB IS " & (Value1) & " % " & "DETAILED" & " AND " & (Value2) &
" % " & "SHIPPED", vbInformation, "PERCENT COMPLETE"
Else
Exit Sub (or some other values and/or message)
End If
End Sub

Mike F
"He4Giv" wrote in message
...
Dear Experts
I have an Auto_Open Macro using the If, Then, Else statement for each time

I
open the spreadsheet it gives me the msgbox of percent completed. Here is
what I have so far and it works with one problem. If Range ("Schedule!L1")

=0
or is blank I get the Debug window upon opening the spreadsheet. How do I
write this macro to tell Auto_open to ignore L1 cell if it is less then 0,

or
= to 0 or is blank?
Cell L1 is formatted for percentage.
Sub Auto_Open()
Dim Value1 As Integer
Dim Value2 As Integer
If Range("Schedule!L1") 0 Then
Value1 = Worksheets("Schedule").Range("L1") * 100
Value2 = Worksheets("Schedule").Range("M1") * 100
MsgBox "YOUR JOB IS " & (Value1) & " % " & "DETAILED" & " AND " & (Value2)

&
" % " & "SHIPPED", vbInformation, "PERCENT COMPLETE"
End If
End Sub
--
He4Giv (Dick)



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default If,Then,Else Macro

He4Giv wrote:
.. How do I .. ignore L1 cell ..
Sub Auto_Open()
Dim Value1 As Integer
Dim Value2 As Integer
If Range("Schedule!L1") 0 Then
Value1 = Worksheets("Schedule").Range("L1") * 100
Value2 = Worksheets("Schedule").Range("M1") * 100
MsgBox "YOUR JOB IS " & (Value1) & " % " & "DETAILED" & " AND " & (Value2) &
" % " & "SHIPPED", vbInformation, "PERCENT COMPLETE"
End If
End Sub


I think you want
If IsNumeric(Range("Schedule!A1")) Then
If Range("Schedule!A1") 0 Then
' ..
End If
End If
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
Macro recorded... tabs & file names changed, macro hangs Steve Excel Worksheet Functions 3 October 30th 09 11:41 AM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
how to count/sum by function/macro to get the number of record to do copy/paste in macro tango Excel Programming 1 October 15th 04 01:16 PM
macro to delete entire rows when column A is blank ...a quick macro vikram Excel Programming 4 May 3rd 04 08:45 PM
Start Macro / Stop Macro / Restart Macro Pete[_13_] Excel Programming 2 November 21st 03 05:04 PM


All times are GMT +1. The time now is 05:50 AM.

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"