Consulting

Results 1 to 3 of 3

Thread: Referencing Named Ranges in UserForms

  1. #1

    Referencing Named Ranges in UserForms

    I'm comingto grips with the fact that macs don't support the .rowsource property. I have this lovely dynamic range that I want to put into a userform combobox, and it looks like I have to resort to an AddItem process. But I seem to be encountering a larger problem. I don't seem to be able to select specific sheets or cells at all from my userform. Is that really the case?

    Here's the code I'm trying to use:

    Private Sub UserForm_Initialize()
           Sheets("Sheet1").Select
            Range("TestListHeader").Select
            Selection.End(xlDown).Select
            Dim i As Integer
                i = ActiveCell.Row
            MsgBox ("The last row number in this list is: " & i)
    End Sub
    Obviously, I'm starting down the path of finding out how many items (rows) I need to add so I can run a neat little additem loop. But I'm getting errors on the very first row, where it's trynig to select the sheet, or the named cell.

    How do you reference cells from VBA on a mac?

  2. #2
    VBAX Tutor
    Joined
    Mar 2005
    Posts
    268
    Location
    That's a little strange. It really ought to work, although you might want to change i to type Long to avoid overflow errors if your list is really long. On my machine it seems to always select the last row of the spreadsheet - not sure if this is the intention. But regardless, there should be no problems selecting specific sheets or cells (from code).

    What error does it give you?

  3. #3

    Working now

    Thanks! I dont' know what was wrong, but after I restarted, Excel ran it perfectly. what a relief!

Posting Permissions

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