resize Picture 1 to fit screen regardless of actual screen size

redspanna

Well-known Member
Joined
Jul 27, 2005
Messages
1,602
Office Version
  1. 365
Platform
  1. Windows
Hi all

On Sheet1 I have a Picture.

When workbook is opened for first time I would like Sheet1 to be selected and then the Picture to be resized automatically to fit the entire screen regardless of the screen size.

is this possible with VBA, if so how ??

Many thanks in advance
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Take a look at the VisibleRange Left,Top, Width and Height Properties and adjust the picture size to them
 
Upvote 0
Take a look at the VisibleRange Left,Top, Width and Height Properties and adjust the picture size to them

but that won't automatically adjust the picture according to the size of screen the worksheet is opened on?
 
Upvote 0
but that won't automatically adjust the picture according to the size of screen the worksheet is opened on?
Code:
Option Explicit

Private Sub Workbook_Open()
    With [B][COLOR=#ff0000]Sheet1[/COLOR][/B].Shapes("[COLOR=#ff0000][B]Image 1[/B][/COLOR]")
        .Parent.Activate
        .LockAspectRatio = msoFalse
        .Left = ActiveWindow.VisibleRange.Left
        .Top = ActiveWindow.VisibleRange.Top
        .Width = ActiveWindow.VisibleRange.Width
        .Height = ActiveWindow.VisibleRange.Height
    End With
End Sub

Change the Sheet codename and picture name in red as required.
 
Upvote 0

Forum statistics

Threads
1,214,834
Messages
6,121,873
Members
449,056
Latest member
ruhulaminappu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top