Solved

Excel Debug Object Required

Posted on 2011-09-14
7
343 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
  • 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
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 500 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

The new Microsoft OS looks great, is easier than ever to upgrade to, it is even free.  So what's the catch?  If you don't change the privacy settings, Microsoft will, in accordance with the (EULA) you clicked okay to without reading, collect all the…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

932 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now