Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Str(Answer) Question

Below is some programming I have put in an excel timesheet spreadsheet. What
I am wanting to do is to take the total hours add them up, and if over 40 a
message box that say you have X number of extra hours. I can get the
Str(answer) to appear in the message box but it returns a value of 0 instead
of the true number. What am I missing?

If Range("P28").Value 40 And Range("P19").Value = "" And
Range("Q19").Value = "" Then
Answer = MsgBox("You have" & Str(Answer) & "extra hours, Do you want
to split these hours between Overtime and Comp Time?", vbYesNo + vbQuestion,
"Week 1 Split")

If Answer = vbYes Then
strInput = InputBox("How much time as Overtime?", "OT")
Range("P19").Value = strInput
strInput = InputBox("How much time as Comp Time?", "Comp")
Range("Q19").Value = strInput

Else

If Answer = vbNo Then
answer1 = MsgBox("You've elected NOT to split your hours
between OT and Comp.", vbOK, "Monday Confirm")

If answer1 = vbOK Then
answer2 = MsgBox("Do you want the time as OT (click
Yes) or Comp (click No)?", vbYesNo, "Monday OT/Comp2")

If answer2 = vbYes Then
Range("P19").Formula = Formula1

Else

If answer2 = vbNo Then
Range("Q19").Formula = Formula1

End If
End If
End If
End If
End If
End If
  #2   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default Str(Answer) Question

I don't see any code prior to this line that assigns a value to "answer". As
far as I can tell, at this point "answer" has a value of 0.

Answer = MsgBox("You have" & Str(Answer) & "extra hours, Do you want
to split these hours between Overtime and Comp Time?", vbYesNo + vbQuestion,
"Week 1 Split")


You could try:
Answer = MsgBox("You have " & Format(Range("P28").Value - 40, "0.00") & "
extra hours, Do you want to split these hours between Overtime and Comp
Time?", vbYesNo + vbQuestion, "Week 1 Split")




"bumper338" wrote:

Below is some programming I have put in an excel timesheet spreadsheet. What
I am wanting to do is to take the total hours add them up, and if over 40 a
message box that say you have X number of extra hours. I can get the
Str(answer) to appear in the message box but it returns a value of 0 instead
of the true number. What am I missing?

If Range("P28").Value 40 And Range("P19").Value = "" And
Range("Q19").Value = "" Then
Answer = MsgBox("You have" & Str(Answer) & "extra hours, Do you want
to split these hours between Overtime and Comp Time?", vbYesNo + vbQuestion,
"Week 1 Split")

If Answer = vbYes Then
strInput = InputBox("How much time as Overtime?", "OT")
Range("P19").Value = strInput
strInput = InputBox("How much time as Comp Time?", "Comp")
Range("Q19").Value = strInput

Else

If Answer = vbNo Then
answer1 = MsgBox("You've elected NOT to split your hours
between OT and Comp.", vbOK, "Monday Confirm")

If answer1 = vbOK Then
answer2 = MsgBox("Do you want the time as OT (click
Yes) or Comp (click No)?", vbYesNo, "Monday OT/Comp2")

If answer2 = vbYes Then
Range("P19").Formula = Formula1

Else

If answer2 = vbNo Then
Range("Q19").Formula = Formula1

End If
End If
End If
End If
End If
End If

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Str(Answer) Question

That works great. Thanks,

"JMB" wrote:

I don't see any code prior to this line that assigns a value to "answer". As
far as I can tell, at this point "answer" has a value of 0.

Answer = MsgBox("You have" & Str(Answer) & "extra hours, Do you want
to split these hours between Overtime and Comp Time?", vbYesNo + vbQuestion,
"Week 1 Split")


You could try:
Answer = MsgBox("You have " & Format(Range("P28").Value - 40, "0.00") & "
extra hours, Do you want to split these hours between Overtime and Comp
Time?", vbYesNo + vbQuestion, "Week 1 Split")




"bumper338" wrote:

Below is some programming I have put in an excel timesheet spreadsheet. What
I am wanting to do is to take the total hours add them up, and if over 40 a
message box that say you have X number of extra hours. I can get the
Str(answer) to appear in the message box but it returns a value of 0 instead
of the true number. What am I missing?

If Range("P28").Value 40 And Range("P19").Value = "" And
Range("Q19").Value = "" Then
Answer = MsgBox("You have" & Str(Answer) & "extra hours, Do you want
to split these hours between Overtime and Comp Time?", vbYesNo + vbQuestion,
"Week 1 Split")

If Answer = vbYes Then
strInput = InputBox("How much time as Overtime?", "OT")
Range("P19").Value = strInput
strInput = InputBox("How much time as Comp Time?", "Comp")
Range("Q19").Value = strInput

Else

If Answer = vbNo Then
answer1 = MsgBox("You've elected NOT to split your hours
between OT and Comp.", vbOK, "Monday Confirm")

If answer1 = vbOK Then
answer2 = MsgBox("Do you want the time as OT (click
Yes) or Comp (click No)?", vbYesNo, "Monday OT/Comp2")

If answer2 = vbYes Then
Range("P19").Formula = Formula1

Else

If answer2 = vbNo Then
Range("Q19").Formula = Formula1

End If
End If
End If
End If
End If
End If

  #4   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default Str(Answer) Question

Glad that helped. Thanks for the feedback.

"bumper338" wrote:

That works great. Thanks,

"JMB" wrote:

I don't see any code prior to this line that assigns a value to "answer". As
far as I can tell, at this point "answer" has a value of 0.

Answer = MsgBox("You have" & Str(Answer) & "extra hours, Do you want
to split these hours between Overtime and Comp Time?", vbYesNo + vbQuestion,
"Week 1 Split")


You could try:
Answer = MsgBox("You have " & Format(Range("P28").Value - 40, "0.00") & "
extra hours, Do you want to split these hours between Overtime and Comp
Time?", vbYesNo + vbQuestion, "Week 1 Split")




"bumper338" wrote:

Below is some programming I have put in an excel timesheet spreadsheet. What
I am wanting to do is to take the total hours add them up, and if over 40 a
message box that say you have X number of extra hours. I can get the
Str(answer) to appear in the message box but it returns a value of 0 instead
of the true number. What am I missing?

If Range("P28").Value 40 And Range("P19").Value = "" And
Range("Q19").Value = "" Then
Answer = MsgBox("You have" & Str(Answer) & "extra hours, Do you want
to split these hours between Overtime and Comp Time?", vbYesNo + vbQuestion,
"Week 1 Split")

If Answer = vbYes Then
strInput = InputBox("How much time as Overtime?", "OT")
Range("P19").Value = strInput
strInput = InputBox("How much time as Comp Time?", "Comp")
Range("Q19").Value = strInput

Else

If Answer = vbNo Then
answer1 = MsgBox("You've elected NOT to split your hours
between OT and Comp.", vbOK, "Monday Confirm")

If answer1 = vbOK Then
answer2 = MsgBox("Do you want the time as OT (click
Yes) or Comp (click No)?", vbYesNo, "Monday OT/Comp2")

If answer2 = vbYes Then
Range("P19").Formula = Formula1

Else

If answer2 = vbNo Then
Range("Q19").Formula = Formula1

End If
End If
End If
End If
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
where can I see my question and answer? Yesterday I ask a question IP Excel Discussion (Misc queries) 2 May 10th 08 04:08 PM
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good davegb Excel Programming 1 May 6th 05 06:35 PM
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good you [email protected] Excel Programming 0 April 27th 05 07:46 PM
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good you [email protected] Excel Programming 23 April 23rd 05 09:26 PM
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good you [email protected] Excel Programming 0 April 22nd 05 03:30 PM


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