+ Reply to Thread
Results 1 to 8 of 8

access listbox on a different sheet

  1. #1
    Registered User
    Join Date
    03-05-2008
    Posts
    21

    access listbox on a different sheet

    Hello,

    I have a listbox on sheet "Mecury" and I want to access and change the listbox's data whenever I click on a button on another sheet called "Jupiter". VBA keeps giving an error and i suspect that its because the listbox is not a global item hence the error. How do i fix this?

    Thank you.

  2. #2
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229
    What kind of listBox is it, ActiveX from the tool box or a Form control?
    The list of either can be filled by a control on a different page, but the syntax is different.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  3. #3
    Registered User
    Join Date
    03-05-2008
    Posts
    21
    Hello mikerickson,

    Its a List Box from the "Control Toolbox" menu which you see on the main view of excel.

    I can access it fine when i write the VBA code in the sheet which contains the List Box but not from other sheets.

    Thanks a lot.

  4. #4
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229
    My Mac doesn't support ActiveX.
    I think the syntax to get the value is
    Please Login or Register  to view this content.
    and similarly for other propertes and methods, like .AddItem.
    Last edited by mikerickson; 09-21-2008 at 08:31 AM.

  5. #5
    Registered User
    Join Date
    03-05-2008
    Posts
    21
    is that Active-X? I thought its just a simple List Box.

    How do you explain that its accessible using the normal method when the VBA code is on the same sheet but Excel throws an error when trying to access using VBA code on another sheet?

    Thanks much.

  6. #6
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482
    Quote Originally Posted by cogar View Post
    is that Active-X? I thought its just a simple List Box.

    How do you explain that its accessible using the normal method when the VBA code is on the same sheet but Excel throws an error when trying to access using VBA code on another sheet?

    Thanks much.
    I believe the ListBox from the controls toolbar is only accessible from the sheet it is created on, if you want access to the same ListBox on all sheets, a UserForm might be a better way to go

  7. #7
    Registered User
    Join Date
    03-05-2008
    Posts
    21
    Hello davesexcel,

    But i can't use a userform because i need the List Box to be embedded on the sheet.

    Any suggestions? Thanks much.

  8. #8
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229
    Testing a work, this, in a normal module, worked for me
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Filling listbox with strings from data sheet
    By AndySuk in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-26-2008, 06:10 AM
  2. [SOLVED] Force a formula from a different sheet.
    By all4excel in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 05-07-2008, 11:04 AM
  3. Macro to Search, Copy/Paste onto New Sheet
    By JADownie in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-13-2008, 04:57 PM
  4. Hide/unhide column with the value of other sheet
    By ss_bb_24 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-05-2007, 02:43 AM
  5. I can't unhide sheet
    By florinicolau in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-23-2007, 05:51 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1