Solved

Excel Debug Object Required

Posted on 2011-09-14
7
345 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
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Lync meeting or Lync conferencing is what many organizations would like to deploy to allow them save money. But companies are now giving up for various reasons, one of which is that they cannot join external meetings (non-federated company meetings)…
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 Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

808 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