Results 1 to 2 of 2

Thread: Names, Ranges and Offsets

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2006
    Posts
    20

    Names, Ranges and Offsets

    I use the following code to copy the contents of a named range

    VB Code:
    1. srcwbk.Names(nameFull).RefersToRange.Copy

    If I wanted to use the whole range - except for the first row, is there and easy way to acheive this.

    Thanks,
    Richard

  2. #2
    Frenzied Member DKenny's Avatar
    Join Date
    Sep 2005
    Location
    on the good ship oblivion..
    Posts
    1,171

    Re: Names, Ranges and Offsets

    This should get you started.


    VB Code:
    1. Sub BenbuinRange()
    2. Dim nameFull As String
    3. Dim rngFullRange As Range
    4. Dim rngNoHeader As Range
    5.    
    6.     nameFull = "testrange"
    7.     Set rngFullRange = ThisWorkbook.Names(nameFull).RefersToRange
    8.    
    9.     With rngFullRange
    10.         Set rngNoHeader = .Range(.Cells(2, 1), .Cells(.Rows.Count, .Columns.Count))
    11.     End With
    12.    
    13.     rngNoHeader.Copy
    14.    
    15.     'rest of your code
    16.    
    17.     Set rngFullRange = Nothing
    18.     Set rngNoHeader = Nothing
    19. End Sub
    Declan

    Don't forget to mark your Thread as resolved.
    Take a moment to rate posts that you think are helpful

Posting Permissions

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



Click Here to Expand Forum to Full Width