Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 206
Default Picture in Cell of Active Sheet

Hi All,

I have a Picture (Picture 5 in Name Box) stored on a hidden sheet.

Is it possible to load this picture in Cell A1 on every active sheet.
Resizing it to the actual A1-Cell size of that active sheet?

Brgds Sige

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Picture in Cell of Active Sheet

Hi Sige,

Try:
'===================
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim pic As Picture
Dim WS As Worksheet
Set WS = Sheets("YOUR HIDDEN SHEET NAME")

If Sh.Name < WS.Name Then
On Error Resume Next
Sh.Pictures.Delete
On Error GoTo 0

Set pic = WS.Pictures("Picture 5")

With pic
.CopyPicture
Sh.Paste Destination:=Sh.Range("A1")

.Top = Range("A1").Top
.Left = Range("A1").Left
.Height = Range("A1").EntireRow.Height
.Width = Sh.Range("A1").EntireColumn.Width

End With
End If
End Sub
'<<===================

Paste this code into the Workbook's ThisWorkbook module, not into a standard
module,

---
Regards,
Norman



"Sige" wrote in message
oups.com...
Hi All,

I have a Picture (Picture 5 in Name Box) stored on a hidden sheet.

Is it possible to load this picture in Cell A1 on every active sheet.
Resizing it to the actual A1-Cell size of that active sheet?

Brgds Sige



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 206
Default Picture in Cell of Active Sheet

Beautiful Norman!

Can the picture resize as well? If cell-size (A1) changes the picture
changes with ...?

Brgds Sige

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Picture in Cell of Active Sheet

Hi Sige,

Can the picture resize as well? If cell-size (A1) changes the picture
changes with ...?


In a standard module, paste the following sub:

'===================
Sub RunOnce()
Dim sh As Worksheet

For Each sh In ActiveWorkbook.Worksheets
If sh.Name < "YOUR HIDDEN SHEET NAME" Then
On Error Resume Next
sh.Pictures.Delete
On Error GoTo 0
End If
Next sh

End Sub
'<<===================

Please run this sub *once*, Change "YOUR HIDDEN SHEET NAME" to the
requisite sheet name.

Then replace your existing Workbook_SheetActivate code with this revised
version:

'===================
Private Sub Workbook_SheetActivate(ByVal sh As Object)
Dim pic As Picture
Dim WS As Worksheet
Dim rng As Range
Set WS = Sheets("YOUR HIDDEN SHEET NAME")
Set rng = sh.Range("A1")

If sh.Name < WS.Name Then
If sh.Pictures.Count = 0 Then
Set pic = WS.Pictures("Picture 5")
pic.CopyPicture
sh.Paste Destination:=rng

With sh.Pictures(1)
.Top = rng.Top
.Left = rng.Left
.Height = rng.Rows(1).RowHeight
.Width = rng.EntireColumn.Width
.Placement = xlMoveAndSize
End With
End If
End If
End Sub
'<<===================


---
Regards,
Norman



"Sige" wrote in message
oups.com...
Beautiful Norman!

Can the picture resize as well? If cell-size (A1) changes the picture
changes with ...?

Brgds Sige



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 206
Default Picture in Cell of Active Sheet

Fantastic! :o)))

I wished my Outline-problem would be the same ... hint, hint ;o)
Cheers Sige

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
jump to active cell in other sheet . mongkolkorn Excel Discussion (Misc queries) 12 June 19th 07 07:30 PM
Active Cell Copy And Paste Sheet to Sheet A.R.J Allan Jefferys New Users to Excel 4 May 4th 06 02:04 AM
Using the Active cell in one sheet for another sheet JOHNNY_E Excel Discussion (Misc queries) 0 May 4th 05 06:19 AM
If active cell found in another sheet axg275[_3_] Excel Programming 5 August 9th 04 10:52 PM
Cell selection in non-active sheet Otto Moehrbach[_6_] Excel Programming 1 July 16th 04 05:16 PM


All times are GMT +1. The time now is 10:59 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"