Results 1 to 5 of 5

Method 'Range' of object'_Worksheet' failed

Threaded View

crowmagnus Method 'Range' of... 05-06-2020, 10:56 AM
crowmagnus Re: Method 'Range' of... 05-06-2020, 11:11 AM
Arkadi Re: Method 'Range' of... 05-06-2020, 11:11 AM
crowmagnus Re: Method 'Range' of... 05-06-2020, 11:13 AM
Arkadi Re: Method 'Range' of... 05-06-2020, 11:14 AM
  1. #1
    Registered User
    Join Date
    06-12-2012
    Location
    Wichita, Kansas
    MS-Off Ver
    Excel 2010, 2016, 2021-22
    Posts
    87

    Method 'Range' of object'_Worksheet' failed

    I keep getting this error when running this code, The ranges are named on the sheet and i double checked them to match, I can't figure it out It gives me and error o
    Range("LVL7Drawing, LVL7Material, LVL7Description, LVL7Dimension").Select
    Complete action
    Private Sub CommandButton2_Click()
    Dim ws As Worksheet
    Dim MyRange As Range
    Dim LastRow As Long
    
    Range("LVL7Drawing, LVL7Material, LVL7Description, LVL7Dimension").Select
    Range("LVL7Drawing, LVL7Material, LVL7Description, LVL7Dimension").Copy
    Set ws = Worksheets.Add
    
      With ws.Range("B2")
        .PasteSpecial xlPasteValues
        .PasteSpecial xlPasteFormats
    
        LastRow = ActiveSheet.Range("B" & Rows.Count).End(xlUp).Row
        Set MyRange = ActiveSheet.Range("B2:E" & LastRow)
        MyRange.RemoveDuplicates Columns:=2, Header:=xlNo
        
    
      'Autofit column
      ws.Columns("A").AutoFit
      
        'Autofit column
      ws.Columns("B").AutoFit
      
        'Autofit column
      ws.Columns("C").AutoFit
      
        'Autofit column
      ws.Columns("D").AutoFit
    
    End With
    End Sub
    Last edited by crowmagnus; 05-06-2020 at 10:59 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] method range of object _worksheet failed
    By rersel in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-12-2019, 06:51 AM
  2. Method range of object _worksheet failed
    By MP1286 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-03-2017, 02:41 PM
  3. [SOLVED] Method 'Range' of object'_Worksheet' failed
    By danfullwood in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-03-2016, 12:33 PM
  4. Method 'Range' of object '_Worksheet' failed
    By vbachallenged in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-17-2012, 02:56 PM
  5. [SOLVED] Method 'Range' of object '_Worksheet' failed
    By Burli in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-24-2012, 05:46 AM
  6. Method 'Range' of object '_Worksheet' failed
    By Kaigi in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-07-2012, 11:06 AM
  7. Method 'Range' of object '_Worksheet' failed (msg)
    By Mamud in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-18-2011, 09:56 AM

Tags for this Thread

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