Results 1 to 10 of 10

Code for button errors due to worksheet name change

Threaded View

  1. #1
    Forum Contributor
    Join Date
    11-09-2007
    Location
    USA
    MS-Off Ver
    2003
    Posts
    141

    Code for button errors due to worksheet name change

    My code works well if the worksheet name is Sheet1. It will change constantly. I have alot of other similar workbooks that are not affected and cannot figure this out. Here is the code that I get the error at:
    Private Sub Test_Click()
    
    Sheet18.Unprotect ("linux")
    Dim Sh As Shape
    With Worksheets("Sheet1")
       For Each Sh In ActiveSheet.Shapes
           If Not Application.Intersect(Sh.TopLeftCell, .Range("F36:AE45")) Is Nothing Then
             If Sh.Type = msoPicture Then Sh.Delete
           End If
        Next Sh
    End With
    CoreFront.Show
    Sheet18.Protect ("linux")
    End Sub
    The error is: Run-time error '9': Subscript out of range
    Any suggestions? Thank You.
    Last edited by ge0rge; 10-15-2008 at 02:22 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. How to amend code to send specific worksheet
    By charliefunkuk in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-16-2008, 08:00 AM
  2. Worksheet_Change event not working on xl2003
    By matrex in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-29-2008, 12:38 PM
  3. Worksheet change event, ignore multiple cells
    By ShaunM in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-07-2008, 01:50 AM
  4. VBA code to change value in a drop down
    By thedon_1 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-17-2008, 08:16 AM
  5. using vba from Access to change Excel worksheet
    By qwertyjjj in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-15-2006, 07:13 PM

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