Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / September 2006

Tip: Looking for answers? Try searching our database.

Picture number

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bobby - 02 Sep 2006 19:20 GMT
How can I know the picture number in a specific cell? I would like to
pass the info to the
ActiveSheet.Shapes("Picture xx").Select
Thank's ahead
Dave Peterson - 02 Sep 2006 21:02 GMT
The pictures actually float over the cells.  But you could use something like:

Dim myCell as range
dim myPict as picture
dim FoundIt as boolean

with activesheet
 set mycell = .range("c9") 'or something
 for each myPict in .pictures
    if mypict.topleftcell.address = mycell.address then
       foundit = true
       exit for
    end if
 next mypict
end with

if foundit = true then
 mypict.select
else
 msgbox "No pictures found!"
end if

> How can I know the picture number in a specific cell? I would like to
> pass the info to the
> ActiveSheet.Shapes("Picture xx").Select
> Thank's ahead

Signature

Dave Peterson

Bobby - 02 Sep 2006 22:12 GMT
Thank's Dave,
When I try the macro I get a mismatch error on

For Each myPict In .Pictures
Any clue?
Thank's ahead

> The pictures actually float over the cells.  But you could use something like:
>
[quoted text clipped - 22 lines]
> > ActiveSheet.Shapes("Picture xx").Select
> > Thank's ahead
Dave Peterson - 02 Sep 2006 22:23 GMT
Did you change other stuff in the code?

Do you still have this line:
dim myPict as Picture

> Thank's Dave,
> When I try the macro I get a mismatch error on
[quoted text clipped - 33 lines]
> >
> > Dave Peterson

Signature

Dave Peterson

Bobby - 04 Sep 2006 00:02 GMT
Dave I did not change anything and yes I still have
dim myPict as Picture

> Did you change other stuff in the code?
>
[quoted text clipped - 38 lines]
> > >
> > > Dave Peterson
Dave Peterson - 04 Sep 2006 02:00 GMT
Post your code.  I don't see anything that jumps out.  (It worked ok for me,
too.)

> Dave I did not change anything and yes I still have
> dim myPict as Picture
[quoted text clipped - 45 lines]
> >
> > Dave Peterson

Signature

Dave Peterson

Bobby - 04 Sep 2006 12:21 GMT
OK this is it:
At the time that I run this macro the cell cursor has a picture in it
at Range("D12")
Sub Macro4()
'
' Macro4 Macro
'
Dim myCell As Range
Dim myPict As Picture
Dim FoundIt As Boolean

With ActiveSheet
 Set myCell = .Range("D12") 'or something
 For Each myPict In .Pictures
    If myPict.TopLeftCell.Address = myCell.Address Then
       FoundIt = True
       Exit For
    End If
 Next myPict
End With

If FoundIt = True Then
 myPict.Select
Else
 MsgBox "No pictures found!"
End If

End Sub

> Post your code.  I don't see anything that jumps out.  (It worked ok for me,
> too.)
[quoted text clipped - 48 lines]
> > >
> > > Dave Peterson
Dave Peterson - 04 Sep 2006 12:44 GMT
I still don't get a mismatch error when I try the code.

> OK this is it:
> At the time that I run this macro the cell cursor has a picture in it
[quoted text clipped - 81 lines]
> >
> > Dave Peterson

Signature

Dave Peterson

Dave Peterson - 04 Sep 2006 14:25 GMT
I don't have a guess why it's not working for you--do you have other shapes in
that activesheet that  might confuse excel?

Maybe going through the shapes collection would work better:

Option Explicit

Sub Macro4()
'
' Macro4 Macro
'
Dim myCell As Range
Dim myShape As Shape
Dim FoundIt As Boolean

With ActiveSheet
 Set myCell = .Range("D12") 'or something
 For Each myShape In .Shapes
    If myShape.TopLeftCell.Address = myCell.Address Then
       FoundIt = True
       Exit For
    End If
 Next myShape
End With

If FoundIt = True Then
 myShape.Select
Else
 MsgBox "No pictures found!"
End If

End Sub

> OK this is it:
> At the time that I run this macro the cell cursor has a picture in it
[quoted text clipped - 81 lines]
> >
> > Dave Peterson

Signature

Dave Peterson

Bobby - 04 Sep 2006 17:26 GMT
Could it be the Excel version that I use?(Excel 2003 (11.8012.6568)
SP2
-
> I don't have a guess why it's not working for you--do you have other shapes in
> that activesheet that  might confuse excel?
[quoted text clipped - 114 lines]
> > >
> > > Dave Peterson
Dave Peterson - 04 Sep 2006 17:50 GMT
I wouldn't think so.

> Could it be the Excel version that I use?(Excel 2003 (11.8012.6568)
> SP2
[quoted text clipped - 121 lines]
> >
> > Dave Peterson

Signature

Dave Peterson

Bobby - 05 Sep 2006 01:24 GMT
Ok Dave thank's again for the trouble I will  keep on trying!
Rgds.
-
> I wouldn't think so.
>
[quoted text clipped - 123 lines]
> > >
> > > Dave Peterson

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.