Consulting

Results 1 to 4 of 4

Thread: Multiselection areas: how to manage?

  1. #1
    VBAX Regular
    Joined
    Jul 2010
    Posts
    6
    Location

    Multiselection areas: how to manage?


    Hi all: sorry for disturb you.
    Have anybody any code example that show me how to manage rows (and some columns values) in a multiselection areas in excel 2003?
    I have it done when I select one row or several continious rows, but if I select several not continous rows it only takes me the first selection.
    Also, as I need to manage only some columns of each row each time, how can I acces it?. I`m using an array, and I fill it firstly with all the datas I need, and then, I read it each time I need to calculate something
    Sorry again but I`m becoming crazy with this problem
    Many thanks

  2. #2
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,873
    Quote Originally Posted by angelin
    but if I select several not continous rows it only takes me the first selection
    Take each area of the selection in turn: [vba]Sub blah()
    For Each are In Selection.Areas
    are.Select 'or whatever
    Next are
    End Sub
    [/vba]
    Regarding "some columns of each row each time", what code have you got so far/are you processing just 1 or two columns or a whole raft of them in each row?
    More info/context would help.
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  3. #3
    VBAX Regular
    Joined
    Jul 2010
    Posts
    6
    Location

    managing selection areas ann fill an array with selected columns

    Hi pa45l
    thanks for your answer

    I don`t know how to fix your code in my project. I need to fill an array with the content of serveral columns (not continued) of several rows (selected 1by 1, or with multiselection , all the same time)
    I thought to use an redimnsionable array because I need to manage the selected datas to create envoices and delivery notes (calculating many thanks)

    I attach you a file.
    I hope you could help me because I don`t whwe to find any example to help me to fix this problem
    thanks

  4. #4
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,873
    The following code isn't very robust, it may not put things in the correct row order and rows may get copied over twice if selections are overlapping but you'll get my drift. I'm working on making it more robust and will post again if I find a way:
    [vba]Sub blah()
    Dim yyy As Range
    If ActiveSheet.Name = "Sheet1" Then
    Set xxx = Selection.EntireRow
    For Each are In xxx.Areas
    Intersect(are, Sheets("Sheet1").Range("A:C, E:F, J:J, L:L")).Copy Sheets("Sheet2").Cells(Rows.Count, "A").End(xlUp).Offset(1)
    Next are
    End If
    End Sub
    [/vba]
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

Posting Permissions

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