Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can a macro be assigned to a button that can identify what...?

Status
Not open for further replies.

Mitsu

Programmer
Sep 23, 1998
22
US
Can a macro be assigned to a button that can identify what cell the clicked button is in ? In other words, If I had a button in a non-selected cell and then clicked on the button, I want the button's macro to identify the cell it is in.

Any ideas?


Thanks in advance,
Mitsu
 
Mitsu,

Please explain how it is that a button is "in" a cell. When you create buttons on a spreadhseet they are on top of the cell or cells, depending on the button position and size. The value of a cell that happens to be under the button is coincidental to the fact that the button is above it.

Depending on what you wish to accomplish, you might be able to use the properties of the button to give you some other information.

 
Yes, I guess it is "over" the cell.

Mitsu
 
may be looping through range.top and range.left properties of each cell within some reasonable range (e.g. 500 by 500 cells) you could find the cell whos top and left properties are closest to your button's top and left.
 
Hi, I need some help for to put an image in a commandbutton with code in VBA excel.
What kind of image it should be? an .ico or a bmp
Thanks 4 your help.

:=)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top