Solved

Excel Debug Object Required

Posted on 2011-09-14
7
344 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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Suggested Solutions

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
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…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

770 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