Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default I need some calculations done in a message text string ...

I'm trying to get a pop-up message to contain a calculated value in the
message text so I know how many label sheets to put in my printer tray before
I print them. I thought the code below would work, but it doesn't. How do I
get the message to display the total number of sheets that I need before I
hit OK?

' Calculate the total number of sheets that need to be printed
Dim LabelSheets As Integer
LabelSheets = Worksheets("Pallet Sheets").Cells(39, 2) + Worksheets("Pallet
Sheets").Cells(39, 3) + Worksheets("Pallet Sheets").Cells(39, 4) +
Worksheets("Pallet Sheets").Cells(39, 5)

If LabelSheets = 0 Then Goto Line1:

' Prompt user to insert the correct number of sheets and then continue
Dim Message, Title
Message="Place "&LabelSheets&" in the tray. Press OK to continue."
Title = "Are you ready to continue?"
mynum = Application.InputBox(Message, Title)
If mynum < "" Then End

Line1:

Don
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default I need some calculations done in a message text string ...

Don,

Maybe this
Sub stance()
' Calculate the total number of sheets that need to be printed
Dim LabelSheets As Integer
LabelSheets = WorksheetFunction.Sum(Worksheets("Pallet
Sheets").Range("B39:e39"))
If LabelSheets = 0 Then GoTo Line1:

' Prompt user to insert the correct number of sheets and then continue
Dim Message, Title
Message = "Place " & LabelSheets & " in the tray. Press OK to continue."
Title = "Are you ready to continue?"
mynum = Application.InputBox(Message, Title)
If mynum < "" Then End
Line1:
End Sub

"Don M." wrote:

I'm trying to get a pop-up message to contain a calculated value in the
message text so I know how many label sheets to put in my printer tray before
I print them. I thought the code below would work, but it doesn't. How do I
get the message to display the total number of sheets that I need before I
hit OK?

' Calculate the total number of sheets that need to be printed
Dim LabelSheets As Integer
LabelSheets = Worksheets("Pallet Sheets").Cells(39, 2) + Worksheets("Pallet
Sheets").Cells(39, 3) + Worksheets("Pallet Sheets").Cells(39, 4) +
Worksheets("Pallet Sheets").Cells(39, 5)

If LabelSheets = 0 Then Goto Line1:

' Prompt user to insert the correct number of sheets and then continue
Dim Message, Title
Message="Place "&LabelSheets&" in the tray. Press OK to continue."
Title = "Are you ready to continue?"
mynum = Application.InputBox(Message, Title)
If mynum < "" Then End

Line1:

Don

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default I need some calculations done in a message text string ...

Thanks Mike, when I try to run this macro I get a Run Time Error '9',
subscript out of range error on the LabelSheets =
WorksheetFunction.Sum(Worksheets("PalletSheets").R ange("B39:E39")) line.

Not sure what the problem is with that line.

Don


"Mike H" wrote:

Don,

Maybe this
Sub stance()
' Calculate the total number of sheets that need to be printed
Dim LabelSheets As Integer
LabelSheets = WorksheetFunction.Sum(Worksheets("Pallet
Sheets").Range("B39:e39"))
If LabelSheets = 0 Then GoTo Line1:

' Prompt user to insert the correct number of sheets and then continue
Dim Message, Title
Message = "Place " & LabelSheets & " in the tray. Press OK to continue."
Title = "Are you ready to continue?"
mynum = Application.InputBox(Message, Title)
If mynum < "" Then End
Line1:
End Sub

"Don M." wrote:

I'm trying to get a pop-up message to contain a calculated value in the
message text so I know how many label sheets to put in my printer tray before
I print them. I thought the code below would work, but it doesn't. How do I
get the message to display the total number of sheets that I need before I
hit OK?

' Calculate the total number of sheets that need to be printed
Dim LabelSheets As Integer
LabelSheets = Worksheets("Pallet Sheets").Cells(39, 2) + Worksheets("Pallet
Sheets").Cells(39, 3) + Worksheets("Pallet Sheets").Cells(39, 4) +
Worksheets("Pallet Sheets").Cells(39, 5)

If LabelSheets = 0 Then Goto Line1:

' Prompt user to insert the correct number of sheets and then continue
Dim Message, Title
Message="Place "&LabelSheets&" in the tray. Press OK to continue."
Title = "Are you ready to continue?"
mynum = Application.InputBox(Message, Title)
If mynum < "" Then End

Line1:

Don

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default I need some calculations done in a message text string ...

Disregard my previous post, it was a simple typo in the sheet name.

"Don M." wrote:

Thanks Mike, when I try to run this macro I get a Run Time Error '9',
subscript out of range error on the LabelSheets =
WorksheetFunction.Sum(Worksheets("PalletSheets").R ange("B39:E39")) line.

Not sure what the problem is with that line.

Don


"Mike H" wrote:

Don,

Maybe this
Sub stance()
' Calculate the total number of sheets that need to be printed
Dim LabelSheets As Integer
LabelSheets = WorksheetFunction.Sum(Worksheets("Pallet
Sheets").Range("B39:e39"))
If LabelSheets = 0 Then GoTo Line1:

' Prompt user to insert the correct number of sheets and then continue
Dim Message, Title
Message = "Place " & LabelSheets & " in the tray. Press OK to continue."
Title = "Are you ready to continue?"
mynum = Application.InputBox(Message, Title)
If mynum < "" Then End
Line1:
End Sub

"Don M." wrote:

I'm trying to get a pop-up message to contain a calculated value in the
message text so I know how many label sheets to put in my printer tray before
I print them. I thought the code below would work, but it doesn't. How do I
get the message to display the total number of sheets that I need before I
hit OK?

' Calculate the total number of sheets that need to be printed
Dim LabelSheets As Integer
LabelSheets = Worksheets("Pallet Sheets").Cells(39, 2) + Worksheets("Pallet
Sheets").Cells(39, 3) + Worksheets("Pallet Sheets").Cells(39, 4) +
Worksheets("Pallet Sheets").Cells(39, 5)

If LabelSheets = 0 Then Goto Line1:

' Prompt user to insert the correct number of sheets and then continue
Dim Message, Title
Message="Place "&LabelSheets&" in the tray. Press OK to continue."
Title = "Are you ready to continue?"
mynum = Application.InputBox(Message, Title)
If mynum < "" Then End

Line1:

Don

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
Text string to Numeric string Manikandan[_2_] Excel Discussion (Misc queries) 2 March 12th 09 08:55 AM
Change 3 letter text string to a number string Pete Excel Discussion (Misc queries) 3 December 31st 07 07:47 PM
Conditional string calculations Marie1uk Excel Worksheet Functions 4 May 28th 06 12:11 AM
Splitting a text string into string and number mcambrose Excel Discussion (Misc queries) 4 February 21st 06 03:47 PM
Time calculations & text conversions Kenny Hubbard Excel Discussion (Misc queries) 1 February 5th 05 10:15 PM


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