Results 1 to 7 of 7

Thread: Get Range Address When Length Of Address Greater than 251 / 255

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Administrator Admin's Avatar
    Join Date
    Mar 2011
    Posts
    1,123
    Rep Power
    10
    Hi,

    Thanks for posting back. I think you can shorten the code little bit, untested though.

    Code:
    Dim MyString() As String, MyString1() As String
        Dim lstList
        
        If Len(Selection.Address(False, False)) > 240 Then
            astr = Replace(Selection.Address, ":", "-")
            lstList = Split(astr, ",")
            FormSlt.LBrowsSlt.List = lstList
        End If

  2. #2
    Senior Member
    Join Date
    Apr 2011
    Posts
    190
    Rep Power
    15
    I often select using Shift+Click & Ctrl+Click - so I have multiple ranges - some continous - some single rows - some just even rows - so I may have more than a single sellection that is >240 characters - doint it using the loop allow me to have as many loops of selections of >240 as I desire. Since I may have multiple loops where the selection.address is greater than 240 - I dont add the last selection to the additem - instead I use it to for the Select fucntion - that way it become the new entry into the next selection. To drive me insane the FormSlt userform is only a placeholder for the rows selected - so I use it to populate other userforms - that way I can carry the selections across userform (and only having one ListBox to manage - I now use the way you set the list in your code rather than using the additem) - using the Form_Activate rather than the Form_initialize sub allow me to have great userform interaction.

Similar Threads

  1. Replace Pivot Table Source Range with New Address VBA
    By Admin in forum Excel and VBA Tips and Tricks
    Replies: 1
    Last Post: 04-25-2013, 07:51 PM
  2. Indirect Address Column Formula help needed
    By trankim in forum Excel Help
    Replies: 4
    Last Post: 10-13-2012, 02:15 PM
  3. Replies: 10
    Last Post: 04-07-2012, 05:33 AM
  4. Get last Filled Cell address in a Range.
    By Rajan_Verma in forum Rajan Verma's Corner
    Replies: 3
    Last Post: 03-24-2012, 01:08 AM
  5. Using Selection.Address
    By Rasm in forum Excel Help
    Replies: 1
    Last Post: 11-28-2011, 05:20 AM

Posting Permissions

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