Results 1 to 4 of 4

Method 'Range' of objects'_worksheet' failed

Threaded View

  1. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646
    With code like this you need a worksheet reference for Cells as well as Range.
    ws.Range(Cells(21, x), Cells(23, 15)).ClearContents
    Here's a couple of ways you can do that.
    ws.Range(ws.Cells(21, x), ws.Cells(23, 15)).ClearContents 
    
    ' or
    
    With ws
       .Range(.Cells(21, x), .Cells(23, 15)).ClearContents 
    End With
    You'll need to add a worksheet reference for Cells wherever you have code like this.
    Last edited by Norie; 01-29-2013 at 03:24 AM.
    If posting code please use code tags, see here.

Thread Information

Users Browsing this Thread

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

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