Results 1 to 21 of 21

copy range to next available cell in column error

Threaded View

  1. #1
    Forum Contributor
    Join Date
    12-02-2009
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    209

    copy range to next available cell in column error

    hi guys,

    can someone please tell me what is wrong with this code:

    I am getting on the line below.. i have commented out the line after the blue as I couldnt seem to get that to work either.

      Sheets("Virtual Servers").Range("A:A").Copy Destination:=ThisWorkbook.Sheets("Templist").Range(NextRow)
    i tried this also but didnt work
    'ThisWorkbook.Sheets("Virtual Servers").Range("A" & NextRow).PasteSpecial Paste:=xlValues
    The intention of this code should be clear, though I am basically copying all the cells in Phys servers WS in Col A to the Templist WS, then I wanted to find the last used row in Templist and, move 1 down, then copy the cells in Virt Servers WS.



    'create new worksheet
        Sheets.Add.Name = "Templist"
        
        Sheets("Physical Servers").Select
    'copy sheets "Physical Servers" contents to "Templist" WS
        Sheets("Physical Servers").Range("A:A").Copy Destination:=ThisWorkbook.Sheets("Templist").Range("A1")
        
    'Find last used row in Templist and + 1 to find next available row
    Dim NextRow As Long
    NextRow = ThisWorkbook.Sheets("Templist").Range("B65536").End(xlUp).Row + 1
    
    'Copy data in Column A within the 'Virtual Servers' to 'Templist' WS
        Sheets("Virtual Servers").Select
    'copy sheets "Physical Servers" contents to "Templist" WS
    
    
    Sheets("Virtual Servers").Range("A:A").Copy Destination:=ThisWorkbook.Sheets("Templist").Range(NextRow)
    'ThisWorkbook.Sheets("Virtual Servers").Range("A" & NextRow).PasteSpecial Paste:=xlValues
    
        
        Sheets("Templist").Select
    'set unique filter
        Range("A2:A65035").AdvancedFilter Action:=xlFilterInPlace, Unique:=True
    Last edited by SarahPintal; 02-19-2010 at 08:21 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1