+ Reply to Thread
Results 1 to 4 of 4

Syntax to set range

Hybrid View

  1. #1
    Registered User
    Join Date
    01-27-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2007
    Posts
    75

    Syntax to set range

    Private Sub UserForm_Initialize()
     Dim space as range
     Dim cell as range
    on error goto correcterror
     Set space = Sheets("font").Range("E1", Range("E1").End(xlDown).address)
     For Each cell In space
       ComboBox1.AddItem cell.formulaR1C1
     Next Cell
    Exit Sub
    correcterror:
    End Sub

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    re: Syntax to set range

    Set space = Sheets("font").Range("E1", Range("E1").End(xlDown).address)
    The second range reference is to the active sheet.
        With Worksheets("font")
            Set Space = .Range("E1", .Range("E1").End(xlDown))
        End With
    Last edited by shg; 02-07-2011 at 01:46 PM.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,252

    re: Syntax to set range

    @shg: wrong question, huh? ;-)
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Registered User
    Join Date
    01-27-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2007
    Posts
    75

    Re: Syntax to set range

    I see; always we use range we need to say what is the sheet. Thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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