Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default type mismatch and/or obj req error from inputbox

In the following code snippet i get different errors depending on how
i dim prrsplat. As variant i get "type mismatch" on the input box, as
integer or double i get "object req" on the variable. The goal for the
code is to have the input not be greater than the "fixed" maximum and
highlight the a section of the original counted range based on how
much of the range the user wants. I hunted around for an answer here
but couldnt find anything that applied closely enough for me to apply
it and work.

thanks in advance

Sheets("PRRS").Select
Range("A2").Select
Range(Selection, Selection.End(xlDown)).Select
Dim numprrs As Double
Dim prrsmaxplat As Double
Dim trunprrs As Integer
Dim prrsplat As Double
Dim prrshl As Integer
numprrs = Selection.Rows.Count
prrsmaxplat = numprrs / 43
trunprrs = Fix(prrsmaxplat)
Do
Set prrsplat = Application.InputBox(Prompt:=("How many plates
to run" & vbLf & "Max plates allowed " & trunprrs), Title:="Number
plates to print/run", Type:=1)
Loop Until prrsplat <= trunprrs
prrshl = prrsplat * 43
' more code from here once this works

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default type mismatch and/or obj req error from inputbox

The set statement is only required when the variable is an object such as a
worksheet or a range. You are using regular variables so you want to drop the
"Set" something like this...

Sheets("PRRS").Select
Range("A2").Select
Range(Selection, Selection.End(xlDown)).Select
Dim numprrs As Double
Dim prrsmaxplat As Double
Dim trunprrs As Integer
Dim prrsplat As Double
Dim prrshl As Integer
numprrs = Selection.Rows.Count
prrsmaxplat = numprrs / 43
trunprrs = Fix(prrsmaxplat)
Do
prrsplat = Application.InputBox(Prompt:=("How many plates
to run" & vbLf & "Max plates allowed " & trunprrs), Title:="Number
plates to print/run", Type:=1)
Loop Until prrsplat <= trunprrs
prrshl = prrsplat * 43

--
HTH...

Jim Thomlinson


"goaljohnbill" wrote:

In the following code snippet i get different errors depending on how
i dim prrsplat. As variant i get "type mismatch" on the input box, as
integer or double i get "object req" on the variable. The goal for the
code is to have the input not be greater than the "fixed" maximum and
highlight the a section of the original counted range based on how
much of the range the user wants. I hunted around for an answer here
but couldnt find anything that applied closely enough for me to apply
it and work.

thanks in advance

Sheets("PRRS").Select
Range("A2").Select
Range(Selection, Selection.End(xlDown)).Select
Dim numprrs As Double
Dim prrsmaxplat As Double
Dim trunprrs As Integer
Dim prrsplat As Double
Dim prrshl As Integer
numprrs = Selection.Rows.Count
prrsmaxplat = numprrs / 43
trunprrs = Fix(prrsmaxplat)
Do
Set prrsplat = Application.InputBox(Prompt:=("How many plates
to run" & vbLf & "Max plates allowed " & trunprrs), Title:="Number
plates to print/run", Type:=1)
Loop Until prrsplat <= trunprrs
prrshl = prrsplat * 43
' more code from here once this works


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default type mismatch and/or obj req error from inputbox

On Nov 2, 10:58 am, Jim Thomlinson <James_Thomlin...@owfg-Re-Move-
This-.com wrote:
The set statement is only required when the variable is an object such as a
worksheet or a range. You are using regular variables so you want to drop the
"Set" something like this...


It worked!! Things like this are hard to figure out on your own when
you are copy and paste/1-2 books self taught. This is an excellent
resource Thank you for your time

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
Visual Basic Error Run Time Error, Type Mismatch Meg Partridge Excel Discussion (Misc queries) 12 September 10th 08 06:10 PM
Conditional Formatting - Run Time Error '13' Type Mismatch Error ksp Excel Programming 0 July 11th 06 07:06 AM
Type Mismatch Error when using InputBox Method Anolan Excel Programming 1 November 22nd 05 07:35 PM
Help: Compile error: type mismatch: array or user defined type expected lvcha.gouqizi Excel Programming 1 October 31st 05 08:20 PM
Befuddled with For Next Loop ------ Run - Time Error '13' Type Mismatch Error rdavis7408 Excel Programming 1 August 25th 04 03:54 AM


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