hiding an image

A

Art

I created a macro in Excel 2007 so users can hide the top two rows of a
spreadsheet to make more real estate to work with the remaining rows.

However, I have an image (our school's logo) in the first row which remains
visible when the two rows are hidden.

I found something online about being able to turn the visibility of an image
off/on, but I do not know how to identify the name of the image. Here's what
I found:

Me.Shapes("picture 2").Visible = True

What is the ME part? Is it the name of the sheet? or the workbook? How do I
find the name of the image?

The same image is used on every sheet and its always the top two rows on any
sheet I want to be able to hide/unhide. So, I want the macro to work for any
sheet in the spreadsheet.

Here's the macro to hide the two rows. I want to include the hide image line
in here as well. (I assume I would just use False to unhide the rows and True
for the visibility of the image as the alternative macro.)

-----------------------------
Sub hidetworows()
'
' hidetworows Macro
' This macro will hide the top two rows in the spreadsheet, including the
kendall logo and directions.
'
' Keyboard Shortcut: Ctrl+h
'
Rows("1:2").Select
Selection.EntireRow.Hidden = True
End Sub
 
G

Gord Dibben

Set the image properties to "Move and Size with cells"

Then it will be hidden with the rows.


Gord Dibben MS Excel MVP
 
A

Art

I used this..and it worked:

I named the image mylogo, then, in the macro, added this line:

ActiveSheet.Shapes("mylogo").Visible = False
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top