+ Reply to Thread
Results 1 to 6 of 6

creating new worksheet tab issue

Hybrid View

Mick S creating new worksheet tab... 04-20-2011, 12:59 PM
tlafferty Re: creating new worksheet... 04-20-2011, 01:09 PM
Mick S Re: creating new worksheet... 04-20-2011, 01:18 PM
tlafferty Re: creating new worksheet... 04-20-2011, 01:23 PM
Mick S Re: creating new worksheet... 04-20-2011, 01:31 PM
Mick S Re: creating new worksheet... 04-20-2011, 01:35 PM
  1. #1
    Registered User
    Join Date
    02-26-2011
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    40

    Smile creating new worksheet tab issue

    I am trying to copy paste special values on tab "april 2010". That works. Next I'm trying to create a new tab. That works. Then I want to move some data from April 2010 onto the newly created tab. That does not work. It gives me a subscript out of range error at:

    Sheets("Open Orders").Range("a1").Select
    What am I doing wrong with regards to moving the data once the second tab has been created? Also is there anyway to do this without selecting everything? I know that's 'slow'.

    Sub DbDatabase_Conversion()
    
    Dim wks As Worksheet
    
    Set wks = Sheets("April 2010 Daily Board")
    
    Application.DisplayAlerts = False
     
    wks.Range("a:ca").Select
    Selection.Copy
    wks.Range("a1").Select
    Selection.PasteSpecial Paste:=xlValues
    
    Sheets.Add.Name = "OpenOrders"
    
    wks.Range("A75:ca104").Select
    Selection.Cut
    
    Sheets("Open Orders").Range("a1").Select
    Selection.PasteSpecial Paste:=xlValues
    
    
    Application.DisplayAlerts = True
    
    End Sub

  2. #2
    Valued Forum Contributor tlafferty's Avatar
    Join Date
    04-08-2011
    Location
    United States, Tacoma, WA
    MS-Off Ver
    Excel 2010, Excel 2013 Customer Preview
    Posts
    1,112

    Re: creating new worksheet tab issue

    You have a space in the worksheet name in one place in the code and no space in the worksheet name in the other:
    OpenOrders
    Open Orders

  3. #3
    Registered User
    Join Date
    02-26-2011
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    40

    Re: creating new worksheet tab issue

    I fixed that but now it fails at:

    [code]wks.Range("A75:ca104").Select[code]

    error msg is select method of range class failed

  4. #4
    Valued Forum Contributor tlafferty's Avatar
    Join Date
    04-08-2011
    Location
    United States, Tacoma, WA
    MS-Off Ver
    Excel 2010, Excel 2013 Customer Preview
    Posts
    1,112

    Re: creating new worksheet tab issue

    Sub DbDatabase_Conversion()
    
    Dim wks As Worksheet
    
    Set wks = Sheets("April 2010 Daily Board")
    
    Application.DisplayAlerts = False
     
    wks.Range("a:ca").Copy
    wks.Range("a1").PasteSpecial Paste:=xlValues
    
    Sheets.Add.Name = "OpenOrders"
    
    wks.Range("A75:ca104").copy 'MUST BE COPIED, CAN'T PASTESPECIAL CUT
    wks.Range("a75:ca104").clearcontents
    Sheets("OpenOrders").Range("a1").PasteSpecial Paste:=xlValues
    
    
    Application.DisplayAlerts = True
    
    End Sub

  5. #5
    Registered User
    Join Date
    02-26-2011
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    40

    Re: creating new worksheet tab issue

    it doesn't like

    Sheets("OpenOrders").Range("a1").PasteSpecial Paste:=xlValues
    pastespecial method of range class failed

  6. #6
    Registered User
    Join Date
    02-26-2011
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    40

    Re: creating new worksheet tab issue

    never mind. i changed the range to "a1:ca29" and it worked

+ Reply to Thread

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