Background Image Scale

Status
Not open for further replies.

warpedone

Board Regular
Joined
May 1, 2002
Messages
139
I have a sheet where I inserted a map as a background image. I put information in various cells based on their proximity to the map. Works great - on my machine.

A coworker opened the same file on his machine and the background image scale was different in relation to his cells (I'm guessing because of a different screen size or different resolution) so that the cells don't line up with the background image the way they do on my computer.

Is there any way to set and hold the scale of the background image so it looks the same no matter what kind of machine it's opened with?
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
warpedone,

One approach is to set the image relative to the range...

Code:
Private Sub Worksheet_Activate()
Application.ScreenUpdating = False
Dim shp As Shape
Set shp = ActiveSheet.Shapes("Picture 1") 'Change to your image name
    With shp
        .LockAspectRatio = False
        .Top = Range("B2").Top 'Change range reference to match your range
        .Left = Range("B2").Left
        .Width = Range("B2:Q2").Width
        .Height = Range("B2:B40").Height
    End With
Application.ScreenUpdating = True
End Sub

The code should be pasted into the sheet module that contains the image. Be sure to change the image name to match your image name, as well as the range references.

Cheers,

tonyyy
 
Upvote 0
Hey, I am getting this highlight when I am trying to debug. I am also trying to get the background image to stay set in relation to the cells (no matter what size screen it is on). What does it mean and how do I fix it? I really appreciate the help.

Matt
 

Attachments

  • background.png
    background.png
    31.2 KB · Views: 84
Upvote 0
Duplicate to: Background Image Scale

In future, please do not post the same question multiple times. Per Forum Rules (#12), posts of a duplicate nature will be locked or deleted.

In relation to your question here, I have closed this thread so please continue in the linked thread.
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,224,823
Messages
6,181,169
Members
453,021
Latest member
Justyna P

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