?
Solved

Excel Debug Object Required

Posted on 2011-09-14
7
Medium Priority
?
351 Views
Last Modified: 2012-05-12
I need to add three buttons to an Excel form to eliminate the billing and typo errors that people are making.

Button 1 = Company 1
Button 2 = Company 2
Button 3 = Collect shipment

I added the buttons and attached a macro to each, but I keep getting the Run-time error'424' Object required.

The three macros are:

Sub BillToOptionButton1()
'
' BillToOptionButton Macro
' Macro recorded 9/12/2011 by Tosagua'

Application.ScreenUpdating = False
If OptionButton1.Value = True Then
       Range("C20").Value = " COMPANY 1 NAME."
       Range("C21").Value = " MAIL  CODE  7A"
       Range("C22").Value = " STREET  ADDRESS."
       Range("C23").Value = " CITY,  STATE  ZIP"
   End If

Application.ScreenUpdating = True
   
'
End Sub

Sub BillToOptionButton2()
'
' BillToOptionButton Macro
' Macro recorded 9/12/2011 by Tosagua
'
    Application.ScreenUpdating = False
   If OptionButton2.Value = True Then
       Range("C20").Value = " COMPANY 2 NAME"
       Range("C21").Value = " C/O  ANOTHER COMPANY."
       Range("C22").Value = " STREET ADDRESS."
       Range("C23").Value = " CITY,  STATE,  ZIP"
   End If

Application.ScreenUpdating = True
   
'
End Sub


Sub BillToOptionButton3()
'
' BillToOptionButton Macro
' Macro recorded 9/12/2011 by Tosagua
'

If OptionButton3.Value = True Then
    MsgBox "Enter The   BILL TO   Information."
Range("C20").Select
End If
'
End Sub


Any assistance or guidance would be greatly appreciated.

Thank you,

Tosagua
0
Comment
Question by:Tosagua
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 24

Expert Comment

by:StephenJR
ID: 36535700
Where have you put this code?
0
 
LVL 24

Expert Comment

by:StephenJR
ID: 36535703
If you try adding the userform, does that help?

E.g.
If UserForm1.OptionButton1.Value = True Then

Open in new window

0
 

Author Comment

by:Tosagua
ID: 36535903
StephenJR,

The macros are in the same workbook as the form.
Adding Userform1 or the name of the worksheet has no benefit.

Tosagua
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 24

Expert Comment

by:StephenJR
ID: 36536003
Tosagua - are you able to post a workbook, with just one button perhaps? I can't replicate your error.
0
 

Author Comment

by:Tosagua
ID: 36536274
StephenJR,

Sample workbook is attached.

The buttons are in the Red Box beneath the form.

Tosagua
BUTTON-TEST-FILE---09-08-11.xls
0
 
LVL 24

Accepted Solution

by:
StephenJR earned 2000 total points
ID: 36536480
It didn't work because you were not using Form buttons but those from the Control menu. You can set a cell link (right-click, format control) and then use code to check the value of the linked cell. In attachment I added second sheet and when a button is clicked A1 records 1, 2 or 3. The buttons are linked to macro which checks that value.
BUTTON-TEST-FILE---09-08-11.xls
0
 

Author Closing Comment

by:Tosagua
ID: 36536535
StephenJR,

Excellent.

Thank you very much.

Tosagua
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question