Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 506079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:39:49+00:00 2026-05-13T06:39:49+00:00

i would like to have an array of objects in excel that call one

  • 0

i would like to have an array of objects in excel that call one event handler. specifically I have multiple buttons which perform the same function to different cells, and to keep from duplicating code I would like to simply reference these button objects via an index (like I used to do in VB 6.0)…. by finding which button was clicked I would like to populate specific cells etc. so the question is: an array of buttons in excel VBA? I’ve done a little work in VB.net where I used collections, and that worked well… but it appears I can’t do that in VBA.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T06:39:50+00:00Added an answer on May 13, 2026 at 6:39 am

    Separate the common code into a single method and pass the cell as the parameter. Assign each button it’s own event method, which in turn calls the common method with the specific cell to edit as a parameter. Something like this:

    Private Sub CommonMethod(someCell as String)
      ' Do your stuff
      Range(someCell).Value = something
    End Sub
    

    So each button could be assigned to it’s own method. This is already built in so don’t try to recreate it, keep it simple.

    Private Sub Button1_Click()
      CommonMethod("A1");
    End Sub
    
    Private Sub Button2_Click()
      CommonMethod("A2");
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an array of objects in my Android app which I would like
I have a javascript array of objects that I would like to use to
I have an array that I would like to sort using a date field
I have byte array as input. I would like to convert that array to
I have an array of integers which represent a RGB image and would like
I have an array of type object which are strings. I would like to
I would like to have an array model objects to be serialized to a
I have an array of objects which I want to sort based on one
I have an array of objects in JavaScript. I would like to sort them
I have an array of appointment objects, and I would like to sort by

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.