Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Object Requi

why am i getting the error "object required" when i try to use this code?



Private Sub CommandButton1_Click()
Dim numberoption As Range

Sheets("Sheet3").Select
SweetenerOptions.Hide

Set numberoption = Application.InputBox("How many senarios would you
like to consider:", "Options")
numberoption.Value = number

If number = 1 Then
PriceChoices.Label1.Enabled = True
End If

If number = 2 Then
PriceChoices.Label1.Enabled = True
PriceChoices.Label2.Enabled = True
End If
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Object Requi

if SweetenerOptions
isnt the code name of a worksheet (or a reference set to some object) then
that would raise the error.

Sub AA()
v = TypeName(Application.InputBox("How many senarios would you like to
consider:", "Options"))
Debug.Print v

End Sub

returns string, so you can't use

Set numberoption = Application.InputBox . . .

and this is backwards:

numberoption.Value = number

it would be
dim numberoption as string
numberoption = Application.InputBox
dim number as Long
nummber = clng(numberoption)

--
Regards,
Tom Ogilvy



"trini" wrote in message
...
why am i getting the error "object required" when i try to use this code?



Private Sub CommandButton1_Click()
Dim numberoption As Range

Sheets("Sheet3").Select
SweetenerOptions.Hide

Set numberoption = Application.InputBox("How many senarios would

you
like to consider:", "Options")
numberoption.Value = number

If number = 1 Then
PriceChoices.Label1.Enabled = True
End If

If number = 2 Then
PriceChoices.Label1.Enabled = True
PriceChoices.Label2.Enabled = True
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
2 Label Options - Forms Object vs Control Box Object Awrex Excel Discussion (Misc queries) 3 July 17th 09 07:10 PM
how to create a formula to hide specific rows after meeting requi DNelson New Users to Excel 2 February 7th 06 01:06 PM
returning pivottable object from a range object Grant Excel Programming 2 September 27th 04 02:22 AM
Range object to Array object conversion Myrna Larson[_2_] Excel Programming 1 August 1st 03 02:27 AM
Range object to Array object conversion Alan Beban[_3_] Excel Programming 0 August 1st 03 01:24 AM


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