Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,670
Default How to edit the code to fit image within specific cell?

Does anyone have any suggestions on how to edit the following code to fit
image within specific cell?

I would like to locate the image cover the cell from B10 (left top corner)
to C 13 ( right bottom corner),
Does anyone have any suggestions on how to resize the and fit within
specific cells?
Thanks in advance for any suggestions
Eric

Private Sub Worksheet_Change(ByVal Target As Range)
Dim myPic As Object
If Target.Address = "$A$1" Then
On Error Resume Next
Set myPic = ActiveSheet.Pictures(1)
On Error GoTo 0
If Not myPic Is Nothing Then myPic.Delete

If Range("A1") = 1 Then
ActiveSheet.Pictures.Insert ("C:\TempPic.JPG")
Else
ActiveSheet.Pictures.Insert ("C:\TempPic2.JPG")
End If

End If
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default How to edit the code to fit image within specific cell?

This will change the size of any image to fit in Column B:
Public Sub Zoom_Pic()
With Worksheets("Picture to Column").Shapes("Picture 1")
.Left = Range("B:B").Left
.Width = Range("B:B").Width
End With
End Sub

You will have to rename the sheet and the picture.

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Eric" wrote:

Does anyone have any suggestions on how to edit the following code to fit
image within specific cell?

I would like to locate the image cover the cell from B10 (left top corner)
to C 13 ( right bottom corner),
Does anyone have any suggestions on how to resize the and fit within
specific cells?
Thanks in advance for any suggestions
Eric

Private Sub Worksheet_Change(ByVal Target As Range)
Dim myPic As Object
If Target.Address = "$A$1" Then
On Error Resume Next
Set myPic = ActiveSheet.Pictures(1)
On Error GoTo 0
If Not myPic Is Nothing Then myPic.Delete

If Range("A1") = 1 Then
ActiveSheet.Pictures.Insert ("C:\TempPic.JPG")
Else
ActiveSheet.Pictures.Insert ("C:\TempPic2.JPG")
End If

End If
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,670
Default How to edit the code to fit image within specific cell?

Thank you very much for suggestions
Could you please tell what I should replace for "Picture 1" for specific
image?
I have try .Shapes("C:\TempPic.JPG"), but does not work.
Thank you very much for any suggestions
Eric

"ryguy7272" wrote:

This will change the size of any image to fit in Column B:
Public Sub Zoom_Pic()
With Worksheets("Picture to Column").Shapes("Picture 1")
.Left = Range("B:B").Left
.Width = Range("B:B").Width
End With
End Sub

You will have to rename the sheet and the picture.

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Eric" wrote:

Does anyone have any suggestions on how to edit the following code to fit
image within specific cell?

I would like to locate the image cover the cell from B10 (left top corner)
to C 13 ( right bottom corner),
Does anyone have any suggestions on how to resize the and fit within
specific cells?
Thanks in advance for any suggestions
Eric

Private Sub Worksheet_Change(ByVal Target As Range)
Dim myPic As Object
If Target.Address = "$A$1" Then
On Error Resume Next
Set myPic = ActiveSheet.Pictures(1)
On Error GoTo 0
If Not myPic Is Nothing Then myPic.Delete

If Range("A1") = 1 Then
ActiveSheet.Pictures.Insert ("C:\TempPic.JPG")
Else
ActiveSheet.Pictures.Insert ("C:\TempPic2.JPG")
End If

End If
End Sub

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default How to edit the code to fit image within specific cell?

Properties must be set to 'move but don't size with cells'. The picture must
be named, like naming a range (located in the upper left hand corner of the
sheet). Try that and see how you get along.


--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Eric" wrote:

Thank you very much for suggestions
Could you please tell what I should replace for "Picture 1" for specific
image?
I have try .Shapes("C:\TempPic.JPG"), but does not work.
Thank you very much for any suggestions
Eric

"ryguy7272" wrote:

This will change the size of any image to fit in Column B:
Public Sub Zoom_Pic()
With Worksheets("Picture to Column").Shapes("Picture 1")
.Left = Range("B:B").Left
.Width = Range("B:B").Width
End With
End Sub

You will have to rename the sheet and the picture.

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Eric" wrote:

Does anyone have any suggestions on how to edit the following code to fit
image within specific cell?

I would like to locate the image cover the cell from B10 (left top corner)
to C 13 ( right bottom corner),
Does anyone have any suggestions on how to resize the and fit within
specific cells?
Thanks in advance for any suggestions
Eric

Private Sub Worksheet_Change(ByVal Target As Range)
Dim myPic As Object
If Target.Address = "$A$1" Then
On Error Resume Next
Set myPic = ActiveSheet.Pictures(1)
On Error GoTo 0
If Not myPic Is Nothing Then myPic.Delete

If Range("A1") = 1 Then
ActiveSheet.Pictures.Insert ("C:\TempPic.JPG")
Else
ActiveSheet.Pictures.Insert ("C:\TempPic2.JPG")
End If

End If
End Sub

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,670
Default How to edit the code to fit image within specific cell?

Thank you for your reply
Could you please show me any example? I don't understand what properties you
are talking about, and don't know how to code it.
Thank you very much for any suggestions
Eric

"ryguy7272" wrote:

Properties must be set to 'move but don't size with cells'. The picture must
be named, like naming a range (located in the upper left hand corner of the
sheet). Try that and see how you get along.


--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Eric" wrote:

Thank you very much for suggestions
Could you please tell what I should replace for "Picture 1" for specific
image?
I have try .Shapes("C:\TempPic.JPG"), but does not work.
Thank you very much for any suggestions
Eric

"ryguy7272" wrote:

This will change the size of any image to fit in Column B:
Public Sub Zoom_Pic()
With Worksheets("Picture to Column").Shapes("Picture 1")
.Left = Range("B:B").Left
.Width = Range("B:B").Width
End With
End Sub

You will have to rename the sheet and the picture.

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Eric" wrote:

Does anyone have any suggestions on how to edit the following code to fit
image within specific cell?

I would like to locate the image cover the cell from B10 (left top corner)
to C 13 ( right bottom corner),
Does anyone have any suggestions on how to resize the and fit within
specific cells?
Thanks in advance for any suggestions
Eric

Private Sub Worksheet_Change(ByVal Target As Range)
Dim myPic As Object
If Target.Address = "$A$1" Then
On Error Resume Next
Set myPic = ActiveSheet.Pictures(1)
On Error GoTo 0
If Not myPic Is Nothing Then myPic.Delete

If Range("A1") = 1 Then
ActiveSheet.Pictures.Insert ("C:\TempPic.JPG")
Else
ActiveSheet.Pictures.Insert ("C:\TempPic2.JPG")
End If

End If
End Sub



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default How to edit the code to fit image within specific cell?

ok, send me an email:

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Eric" wrote:

Thank you for your reply
Could you please show me any example? I don't understand what properties you
are talking about, and don't know how to code it.
Thank you very much for any suggestions
Eric

"ryguy7272" wrote:

Properties must be set to 'move but don't size with cells'. The picture must
be named, like naming a range (located in the upper left hand corner of the
sheet). Try that and see how you get along.


--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Eric" wrote:

Thank you very much for suggestions
Could you please tell what I should replace for "Picture 1" for specific
image?
I have try .Shapes("C:\TempPic.JPG"), but does not work.
Thank you very much for any suggestions
Eric

"ryguy7272" wrote:

This will change the size of any image to fit in Column B:
Public Sub Zoom_Pic()
With Worksheets("Picture to Column").Shapes("Picture 1")
.Left = Range("B:B").Left
.Width = Range("B:B").Width
End With
End Sub

You will have to rename the sheet and the picture.

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Eric" wrote:

Does anyone have any suggestions on how to edit the following code to fit
image within specific cell?

I would like to locate the image cover the cell from B10 (left top corner)
to C 13 ( right bottom corner),
Does anyone have any suggestions on how to resize the and fit within
specific cells?
Thanks in advance for any suggestions
Eric

Private Sub Worksheet_Change(ByVal Target As Range)
Dim myPic As Object
If Target.Address = "$A$1" Then
On Error Resume Next
Set myPic = ActiveSheet.Pictures(1)
On Error GoTo 0
If Not myPic Is Nothing Then myPic.Delete

If Range("A1") = 1 Then
ActiveSheet.Pictures.Insert ("C:\TempPic.JPG")
Else
ActiveSheet.Pictures.Insert ("C:\TempPic2.JPG")
End If

End If
End Sub

Reply
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
How to edit the code to insert more than 1 image? Eric Excel Programming 2 February 9th 10 03:28 PM
display image when specific value in a cell exist nicosalt Excel Discussion (Misc queries) 1 April 7th 06 07:55 PM
Insering an image on a specific cell Moiz Excel Programming 1 December 10th 05 10:56 AM
protect specific cell but allow edit on other cell chiuinggum Excel Worksheet Functions 5 December 8th 05 06:22 PM
How do I insert an image into a specific cell within a protected . Scott Peebles Excel Discussion (Misc queries) 1 January 7th 05 01:14 AM


All times are GMT +1. The time now is 03:18 PM.

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

About Us

"It's about Microsoft Excel"