LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jim Jim is offline
external usenet poster
 
Posts: 615
Default Select Worksheet Code

I'm not a VBA code person, however I have been mostly succesfull with copying
and pasting code from everyone's help here, much appreciated. I'm having
trouble with the following code:

Option Explicit

Private Sub Worksheet_Calculate()
ActiveSheet.Unprotect Password:="Profit"

Dim oPic As Picture
Me.Pictures.Visible = False
With Range("C2")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = .Top
oPic.Left = .Left
Exit For
End If
Next oPic
End With
ActiveSheet.Protect Password:="Profit"
End Sub

The code works great on the sheet (Loan Package ENG) I want it to. On the
VBA editor this code is shown on Sheet4 (Loan Package ENG). However when I
enter data on a seperate sheet, I get:

Run-time error '1004':

Unable to set the Top property of the Picture class

When I click the Debug option, it takes me to the code above with 'oPic.Top
= .Top' highlighted.

I would like some help fixing this with correct code, but also a bit of an
explanation of why the error is occuring to help me understand VBA better.

Thanks
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
SELECT THE FIRST CELL IN ADVANCE FILTERed worksheet vba code CmK Excel Programming 2 June 10th 07 12:53 PM
VBa code to select from worksheet mike Excel Programming 2 March 31st 06 12:46 AM
VB select code for a worksheet Vicki Excel Programming 3 December 8th 05 09:43 PM
In Excel 2000, How do you select the whole of a worksheet (Select. Rascal Excel Discussion (Misc queries) 1 March 5th 05 12:03 AM
In Excel 2000, How do you select the whole of a worksheet (Select. Rascal Excel Discussion (Misc queries) 1 March 4th 05 11:59 PM


All times are GMT +1. The time now is 07:00 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"