create macro

  • Thread starter Thread starter Khalil Handal
  • Start date Start date
K

Khalil Handal

Hi,
How can I create a TWO seperate macros in a spreadsheet in Excel:
there are icons/pictures which have a macro attached to it. How do I attach
the macro?

macro 1:
to move to a different cell address like B158.

macro 2:
to print a certain range of cells. (say A158:G200)

Thank u in advance
Khalil
 
One way:

Put something like these in a regular code module:

Public Sub MoveMacro()
Application.GoTo .Range("B158"), Scroll:=True
End Sub

Public Sub PrintCertainRange()
With ActiveSheet
.PageSetup.PrintArea = "A158:G200"
.PrintOut Preview:=True
.PageSetup.PrintArea = ""
.DisplayPageBreaks = False
End With
End Sub

Right-click your pictures, choose Assign Macro, and assign each picture
one of the above.
 
Back
Top