Determine Shape Clicked For Running Macro

Nov 19, 2008

I have map shape in my excel sheet. each country is a shapes on its own. If i Select one of the country i want to display a pop up Box. For examle if i select Americas I need it to display another box with some data and when i deselect it it should hide the box. Tried some code over here but does not work.

Sub HideShowRectangle()
With ActiveSheet.Shapes("Data1")
If ActiveSheet.Shapes("Americas").Select = "True" Then
.Visible = True
Else
.Visible = False
End If
End With
End Sub

View 5 Replies


ADVERTISEMENT

Get The Name Of The Shape Clicked

Jan 21, 2009

Is there any way that I can get the name of the shape i just clicked to call a procedure?

I have 35 shapes in my Worksheet.
Each shape has a different name. Each shape has a macro procedure assigned, wich do almost the same procedure (with just small differences, depending on from wich shape the macro was called).

I want to make just one macro procedure and catch from wich shape the macro was called.

View 4 Replies View Related

Which Hyperlink Was Clicked And Associated Shape Name

Feb 10, 2010

How do I capture which hyperlink has been clicked (selected in any fashion)?

Then get associated shape name.

View 11 Replies View Related

Determine Position Of Shape/Button On Worksheet

Jun 2, 2008

I have written a small piece of code that handles clicks on buttons on an excel spread sheet. When a button is pressed, i need to know the row number where the button resides in.

I have searched and read about this issue on several forums, and they all indicate that i need to use something like

application.caller.topleftcell.row

to get the row number and

application.caller.topleftcell.column

to get the column number.

However, when i use the row variant, it ALWAYS returns row number 1. When i use the column variant, it returns the column number it is actually in.

i have added the full code that is creating the buttons below, and also the part that displayes the rownumber that is incorrect.

Private Sub Workbook_Open()
Dim name
Dim time As Integer
time = InputBox("Typ the hour you are checking" & vbCrLf & "eg: 7, 10, 13, 14, 15, 16, 17, 18, 19", "Which Check")

View 9 Replies View Related

Run Macro When File Print Is Clicked?

Sep 11, 2012

Am I able to call a macro when someone clicks "file" and then "print"? I have a macro ready to go, but I am unable to right click and assign a macro to the print button.

View 3 Replies View Related

Call Macro If Button Is Clicked

Jan 30, 2009

I need a code for "click-able button" in my excel sheet that will call makro "copy" which I have connected with ThisWorkBook /Sub copy() .../ or in other case with Modules (module 7 for example).

So, what to add between this:

Private Sub CommandButton1_Click()

?

End Sub

View 9 Replies View Related

Change Shape Text Without Selecting Shape

Mar 4, 2009

when i run the below code i get an error 438 'object doesnt support this property or method'

View 2 Replies View Related

Use Private Sub Function To Store Clicked Cell As Variable For Use In Macro?

Apr 20, 2013

I have a spreadsheet with near 300 tabs, each with a picture in the tab. The main tab has a list of all other tabs, the goal is to allow the user to click on a cell next to an entry, and have Excel flash the referenced tab to allow the user to see what the entry is referencing. I have written a simple macro that activates a desired tab, unhides it, displays a message box to pause the macro, rehides the tab, then returns the user to the main tab.

Rather than creating a macro for all 300 tabs and creating buttons I would love to use the Private Sub Worksheet_SelectionChange(ByBal Target As Range) or some variation thereof, to make my life much easier. The name of the tab is in cell A2, so I would want to have the user click on cell A1, activate the macro, then take A1 to A2 with something like A1 = A(x+1)->A2, then display the tab listed in A2. So rather than have 300 macros with Sheets("XYZ").Visible = True, I would love it to read Sheets(contents of referenced cell).Visible = True. with the contents of referenced cell coming from some manipulation of the cell I clicked on...

View 4 Replies View Related

When Cell Clicked, Stays "clicked" Highlights All

Jan 10, 2007

What in the world did I do now? When I click on any cell, the cursor turns into a thick "+" . Then, when I move my mouse up and down the spreadsheet, all the cells the "+" touches become highlighted.

View 9 Replies View Related

Macro To Enter Shape Or Picture?

Sep 30, 2012

I am making a spreadsheet file for our football offcials group to review rules.

I tried to record a macro to copy a shape and put it into the spreadsheet, but the shape does not copy.

How do I get the shape to copy into the spreadsheet?

What I want is for them to "think" what they would do and then click the macro and it will show them where the ball would be after the foul/fouls.

View 2 Replies View Related

Assigning Macro To Shape In 2007

Dec 5, 2008

I posted similar yesterday. No one helped...sniff sniff (where's the crying smily)

Now verified to be occur on other machines running various versions of Office 2007...

In Excel 2007, write this simple macro and assign it to a shape:

View 6 Replies View Related

How To Add Formatting To Shape Creation Macro

Aug 7, 2013

I have to create an identical button on 20 sheets.

I have a shape creation macro but it creates in the default format.

Can I either change the default format so they are created in the way I want or code to add formatting? I need no shadow, can colour (pref with gradient fill), bevelled edges and text.

Sounds like the first option will be easiest if it works!

View 1 Replies View Related

Macro To Select Shape To Print Off

Jan 2, 2014

I created a shape and named it Cheque and created a macro to print the shape as follows:

ActiveSheet.Shapes("Cheque").PrintOut

But the macro is not printing!

View 4 Replies View Related

VBA Macro To Move Shape Around Spreadsheet

Dec 16, 2009

I am trying to write a set of code, part of which involves moving a shape around an excel spreadsheet in a square shape within a certain range. It is based on a random number generator. The shape moves a number of cells to the left/right/up/down depending on the random number (d) multiplied by 16. If the shape reaches a row or column border point, it will change direction but continue moving in the new direction until it has gone as far as was determined by the random number (*16). I have some code which works fine... to a point! The shape starts out, reaches a right hand border, changes direction to go up, reaches another border, changes again and goes left, but then when it comes to change dorection the 3rd time and go down, it fails. The direction of the shape is determined by a word in cell A1 - left/right/up/down:

Sub MoveRed()
Application. ScreenUpdating = True
Dim d As Integer
Dim i As Integer

d = Range("AZ1").Value

With ActiveSheet.Shapes("RedDot")
For i = 1 To 16 * d

Select Case Range("A1").Value
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

View 9 Replies View Related

Using Shape To Call Macro (Filepath Error)

Apr 9, 2014

I am changing command buttons over to shapes for aesthetic purposes. I went to assign a macro to call useform4 using a rectangle with the following code:

[Code] .....

It throws me some kind of file path error which makes no sense. Do I have to dim the rectangle2 for active sheet or something?

View 11 Replies View Related

Run Macro After Leaving Shape Editing Mode?

May 14, 2014

I've got a macro function which calculates the area of a polygon freeform using the 'shoelace'-methode. I would like to excute this function after i leave the shape editing mode.

For example: I have a square, freeform shape. By right-mouseclick I can edit the shape nodes. If i drag one of the nodes of the square to another position and click outside of the shape, the new shape is updated. Right, on that moment i would like to trigger my macro to recalculate the area.

Is there an event in excel to aim for, like the Worksheet.change-event or something similar?

View 2 Replies View Related

Automatically Assigning Macro To Any Shape Created

Aug 14, 2014

I've got a macro that I can rund when I click on a shape. It's called "Shape_Click".

Basically, I want this macro to be automatically assigned to any shape I create, as I create it.

I know the line will be something like: [Code] ........

View 6 Replies View Related

Automatically Assigning Macro To Created Shape?

Aug 14, 2014

I have a macro that runs when I click on a shape. This macro is called "Shape_Click"

I can apply that to a shape by selecting it and manually running this macro:

[Code] .....

How do I get the subroutine to run as soon as the new shape has been selected, rather than haviong to manually run it.

Something like "Sub Worksheet_ShapeAdded" or something like that? I can't work it out.

View 2 Replies View Related

Excel 2002 :: Activate Macro By Clicking A Shape

Feb 3, 2013

I found in an old file that i triggered the macro by clicking a button! I would post a pic but i don't know how. How do I activate a macro by clicking a shape on the excel 2002 page?

View 7 Replies View Related

Chart Hyperlinks: Attach A Macro So That When The Chart Is Clicked It Returns To Sheet - Home

Feb 24, 2007

I know this has been discussed a number of times, but here is my problem
I have three charts in my workbook. I want to attach a macro so that when the chart is clicked it returns to Sheet - Home. I have using the following:
worksheets("Home").activate. But after I protect each chart and the workbook, and save and exit. When I reload the Workbook it has forgotten the assigned macros and nothing happens.

View 7 Replies View Related

Macro Stops Running The Macro Completely And Hangs In The Middle

Jul 3, 2007

Here in our department we made a pretty elaborate macro that takes a report and sorts them out to 17 different sheets in a one workbook. This Macro pulls a file from a specific location on our server and then opens the CSV sorts it out color codes all the important information and saves it back onto the server under you specific initials.

They are four PC's along with our Managers laptop that run this Macro daily.

About 3 weeks ago my Managers laptop stops running the Macro completely and hangs in the middle of the whole thing. Eventually crashing Excel.

We try to remove the modules and re-import them back into the personal macro workbork but this does not work. The Macro's did not change and still fully function on the other four desktops to this day.

I uninstall Office on my Managers laptop and reinstall. Import the Modules again and still hangs up in very same spot it did 3 weeks ago.

I've tried to lower the macro security to the lowest level also and I've still had no luck with this laptop. I don't understand. The Macro's function perfectly on other PC's but will not function on this laptop.

View 9 Replies View Related

Running A Macro When A Value Is Reached In A Specific Cell Used To Call Up Macro

Jan 7, 2009

I have a Sheet sheet1 and I want to run a macro when the cell D2 in Sheet1 is equal to 10,7,5,and 3. I only want this macro to run when those values are reached the macro then puts the data onto a sheet called wps. The macro is run as a module and is a sub macro.

View 9 Replies View Related

Macro To Determine Values

Jun 8, 2009

I have two columns in my spreadsheet:

Test1 Passed
Test1 Passed
Test1 Failed
Test2 Passed
Test2 Passed
Test2 Passed

I need a macro to find all of the same values in column 1 and then look to see if column 2 all of the values are Passed and if they aren't make a new column with the value that isn't passed so after the macro of formula is run you'll have:

Test Status Overall
Test1 Passed Failed
Test1 Passed Failed
Test1 Failed Failed
Test2 Passed Passed
Test2 Passed Passed
Test2 Passed Passed

View 9 Replies View Related

Locate A Shape Within A Shape

Jan 24, 2014

On the attached spreadsheet there is two irregular shapes. "Area1" & "Area2". I need to be able to determine which area the "ball" shape is located in. If the ball is in Area1 then "Multiply 8" gets the ball and "Multiply 9" moves to the blue cell "AH39". If the ball is in "AreaB" Multiply 9 gets the ball and "Multiply 8" runs to cell "S37"

I should be able to do the moving of the shapes using all the samples, its determining which area the ball is in is the problem.

In the real spreadsheet i will probably have around 10 different Areas.

Move Two Objects - Select Case.xlsm‎

View 5 Replies View Related

Macro That Will Determine Value And Copy Row To Another Sheet?

Dec 17, 2013

pulling out data in a column, lets say column K, that is between a 12 and 20. There are quite a few lines so I would like to be able to pull them out automatically. In addition, I would like for the macro to pull the entire row of data not just the specific cell value.

View 3 Replies View Related

Determine Current Date In Macro

Nov 7, 2006

I'm trying to write a batch file that connects to a database and passes in an SQL query. One of the conditions of this query is the date. I need the batch file to figure out what todays date is and pass that in.

This is what I currently have.

ws_tran_date between to_date( '&datefrom 08:30:00AM', 'DD-MON-YYYY HH:MI:SS AM') and TO_DATE('&dateto 08:30:00am', 'DD-MON-YYYY HH:MI:SS AM')

When I run the batch file, it asks me to input the dates manaully in the format DD-MON-YYYY (eg 7-NOV-2006). I need the batch file to figure this out on it's own.

Is there some function I can call to do this?

View 5 Replies View Related

Macro IF To Determine If Cell Has Today Date

Mar 28, 2012

I've been using the following code and would like to add another IF that checks the value of a cell to see if it holds today's date.

Code:
If Range("E" & CStr(LSearchRow)).Value "Closed" Then
If Range("E" & CStr(LSearchRow)).Value "Closed w/o Customer Confirm" Then
'Select SR in Sheet to update
Range("B" & CStr(LSearchRow)).Select

[Code] ......

I tried to modify it to...

Code:
If Range("E" & CStr(LSearchRow)).Value "Closed" Then
If Range("E" & CStr(LSearchRow)).Value "Closed w/o Customer Confirm" Then
If Range("AK" & CStr(LSearchRow)).Value "=today()" Then
'Select SR in Sheet to update

[Code] ......

I've tried a couple of other things but no success

View 5 Replies View Related

Determine #NAME- Formula Error In Macro Code

Mar 18, 2008

I am trying to reference a cell that displays "#NAME?" due to an unrecognized formula. However, I keep getting an "Type Mismatch" error. Is there a way to reference a file that displays "#NAME?"

Example:

If Sheets("sheet1").Range("B6") = "#name?" Then
Sheets("sheet1").Range("B3").ClearContents
End If

View 5 Replies View Related

Determine Version Number Via Macro Code

Apr 17, 2008

This is probably a simple question, but I couldn't find the answer by searching...

I have a macro that I wish to run which calls one of two different macro's depending on if the user has Excel version 2007 or if they have an earlier version.

This is to overcome 'Save as PDF', which only works in Excel 2007.

View 3 Replies View Related

Determine Date System Of Workbook In Which Macro Resides

Oct 24, 2007

I have written a few macros, which use date type variables. Because VBA uses the 1900 date system, and some workbooks use the 1904 date system, I have to first check and see if a workbook uses the 1904 date system, and if so, subtract off 1462 days where appropriate. My macros used to check the date system by using the command:

If ( ActiveWorkbook.Date1904 = True) Then
nh_stringToDate = nh_stringToDate - 1462
End If

But, sometimes the macro resides in one workbook (call it macro.xls) but the currently active workbook is some other workbook (something.xls). What I really care about is the date system of macro.xls and NOT something.xls. So, instead of "ActiveWorkbook" is there some other object I can use to refer to the workbook in which the macro itself resides? I don't want to rely on using the name of the macro workbook (macro.xls) because this could change! So I need a way to simply refer to the workbook in which the macro resides.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved