VBA define region
Power Query Course in Spanish
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 4 of 4

Thread: VBA define region

  1. #1
    Guest

    Default

     
    Hi fellas,

    Set LastCell = Range("B65536").End(xlUp)
    Set CodeRange = Range(A2, LastCell).

    ListBox1.RowSource = "'Officer Code'!a2:b33"

    Need help with this... How do I define a range such that it starts from A2 and ends at LastCell ie the Set CodeRange line..

    Then I want to set it as the RowSource to the ListBox... Any ideas guys??

    Thanks

  2. #2
    MrExcel MVP Ivan F Moala's Avatar
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    4,209
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Set Lastcell = Range("B65536").End(xlUp)
    Set CodeRange = Range("A2", Lastcell.Address)

    ListBox1.RowSource = CodeRange.Address

    Ivan

  3. #3
    Rest in Peace
    Join Date
    Feb 2002
    Posts
    1,582
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Not eaxctly sure I have understood you but, try:

    Sheet2.Range("A2", Sheet2.Range("B65536").End(xlUp)).Name = "MyRange"
    ListBox1.RowSource = "MyRange"

  4. #4
    Guest

    Default

      
    Cheers guys

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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

 

 
DMCA.com