Consulting

Results 1 to 4 of 4

Thread: Solved: how to use variables with rows selection

  1. #1

    Solved: how to use variables with rows selection

    A VBA newbie qeustion...

    I want to copy rows of data using something like Rows("A3:B5").Select but the values of the range to be used are stored in an array called data() so I want to say something like Rows(data(1):data(2)).Select - but the VBA complier is saying that isn't allowed!

    Can someone point me in the right direction? ...many thanks

  2. #2
    Sorry, I should have said Rows(3:5).Select as an example or Range(A3:B5).Select

  3. #3
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Rows(start_row_num & ":" & end_row_num)
    [/vba]

    or

    [vba]

    Rows(start_row_num).Resize(end_row_num - start_row_num + 1)
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  4. #4

    That works

    That works - thanks very much!

Posting Permissions

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