Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Use shape location to clear cells

I would like to use a series of shapes to clear cells on a worksheet. For
example:

Shape1 exists in Cell A1. When clicked, it clears cells B1 and C1
Shape 2 exists in Cell A2. When clicked, it clears cells B2 and C2

and so on.

I need the references to be relative because I regularly re-sort the sheet
and the order of the shapes changes with all the cells. Basically, I want a
sub to figure out where the image is located and then clear the two adjacent
cells. Any ideas? Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Use shape location to clear cells

Hi

Try this

Dim rw As Long
rw = Range(ActiveSheet.Shapes(Application.Caller).TopLe ftCell.Address).Row
Range(Cells(rw, "A"), Cells(rw, "D")).Select


--
Regards Ron De Bruin
http://www.rondebruin.nl



"Newt" wrote in message ...
I would like to use a series of shapes to clear cells on a worksheet. For
example:

Shape1 exists in Cell A1. When clicked, it clears cells B1 and C1
Shape 2 exists in Cell A2. When clicked, it clears cells B2 and C2

and so on.

I need the references to be relative because I regularly re-sort the sheet
and the order of the shapes changes with all the cells. Basically, I want a
sub to figure out where the image is located and then clear the two adjacent
cells. Any ideas? Thanks!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Use shape location to clear cells

I had tried to use some similar code previously, but in both cases get a Type
mismatch error. I'm using Excel 2003 if that matters. Any ideas? Thanks.

"Ron de Bruin" wrote:

Hi

Try this

Dim rw As Long
rw = Range(ActiveSheet.Shapes(Application.Caller).TopLe ftCell.Address).Row
Range(Cells(rw, "A"), Cells(rw, "D")).Select


--
Regards Ron De Bruin
http://www.rondebruin.nl



"Newt" wrote in message ...
I would like to use a series of shapes to clear cells on a worksheet. For
example:

Shape1 exists in Cell A1. When clicked, it clears cells B1 and C1
Shape 2 exists in Cell A2. When clicked, it clears cells B2 and C2

and so on.

I need the references to be relative because I regularly re-sort the sheet
and the order of the shapes changes with all the cells. Basically, I want a
sub to figure out where the image is located and then clear the two adjacent
cells. Any ideas? Thanks!




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Use shape location to clear cells

Do you use controls from the Forms or Control toolbox

--
Regards Ron De Bruin
http://www.rondebruin.nl



"Newt" wrote in message ...
I had tried to use some similar code previously, but in both cases get a Type
mismatch error. I'm using Excel 2003 if that matters. Any ideas? Thanks.

"Ron de Bruin" wrote:

Hi

Try this

Dim rw As Long
rw = Range(ActiveSheet.Shapes(Application.Caller).TopLe ftCell.Address).Row
Range(Cells(rw, "A"), Cells(rw, "D")).Select


--
Regards Ron De Bruin
http://www.rondebruin.nl



"Newt" wrote in message ...
I would like to use a series of shapes to clear cells on a worksheet. For
example:

Shape1 exists in Cell A1. When clicked, it clears cells B1 and C1
Shape 2 exists in Cell A2. When clicked, it clears cells B2 and C2

and so on.

I need the references to be relative because I regularly re-sort the sheet
and the order of the shapes changes with all the cells. Basically, I want a
sub to figure out where the image is located and then clear the two adjacent
cells. Any ideas? Thanks!






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Use shape location to clear cells

Actually neither. I was hoping to link the code via a macro to an autoshape
drawing object. If I must use controls, I would prefer to use the Control
toolbox. Thanks.

"Ron de Bruin" wrote:

Do you use controls from the Forms or Control toolbox

--
Regards Ron De Bruin
http://www.rondebruin.nl



"Newt" wrote in message ...
I had tried to use some similar code previously, but in both cases get a Type
mismatch error. I'm using Excel 2003 if that matters. Any ideas? Thanks.

"Ron de Bruin" wrote:

Hi

Try this

Dim rw As Long
rw = Range(ActiveSheet.Shapes(Application.Caller).TopLe ftCell.Address).Row
Range(Cells(rw, "A"), Cells(rw, "D")).Select


--
Regards Ron De Bruin
http://www.rondebruin.nl



"Newt" wrote in message ...
I would like to use a series of shapes to clear cells on a worksheet. For
example:

Shape1 exists in Cell A1. When clicked, it clears cells B1 and C1
Shape 2 exists in Cell A2. When clicked, it clears cells B2 and C2

and so on.

I need the references to be relative because I regularly re-sort the sheet
and the order of the shapes changes with all the cells. Basically, I want a
sub to figure out where the image is located and then clear the two adjacent
cells. Any ideas? Thanks!








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Use shape location to clear cells

It is working with a autoshape drawing and forms controls

Add a few autoshapes on your sheet
Assign this macro to all of them

Sub test()
Dim rw As Long
rw = Range(ActiveSheet.Shapes(Application.Caller).TopLe ftCell.Address).Row
Range(Cells(rw, "A"), Cells(rw, "D")).Select
End Sub


--
Regards Ron De Bruin
http://www.rondebruin.nl



"Newt" wrote in message ...
Actually neither. I was hoping to link the code via a macro to an autoshape
drawing object. If I must use controls, I would prefer to use the Control
toolbox. Thanks.

"Ron de Bruin" wrote:

Do you use controls from the Forms or Control toolbox

--
Regards Ron De Bruin
http://www.rondebruin.nl



"Newt" wrote in message ...
I had tried to use some similar code previously, but in both cases get a Type
mismatch error. I'm using Excel 2003 if that matters. Any ideas? Thanks.

"Ron de Bruin" wrote:

Hi

Try this

Dim rw As Long
rw = Range(ActiveSheet.Shapes(Application.Caller).TopLe ftCell.Address).Row
Range(Cells(rw, "A"), Cells(rw, "D")).Select


--
Regards Ron De Bruin
http://www.rondebruin.nl



"Newt" wrote in message ...
I would like to use a series of shapes to clear cells on a worksheet. For
example:

Shape1 exists in Cell A1. When clicked, it clears cells B1 and C1
Shape 2 exists in Cell A2. When clicked, it clears cells B2 and C2

and so on.

I need the references to be relative because I regularly re-sort the sheet
and the order of the shapes changes with all the cells. Basically, I want a
sub to figure out where the image is located and then clear the two adjacent
cells. Any ideas? Thanks!








  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Use shape location to clear cells

Or

rw = ActiveSheet.Shapes(Application.Caller).TopLeftCell .Row



Ron de Bruin wrote:

Hi

Try this

Dim rw As Long
rw = Range(ActiveSheet.Shapes(Application.Caller).TopLe ftCell.Address).Row
Range(Cells(rw, "A"), Cells(rw, "D")).Select

--
Regards Ron De Bruin
http://www.rondebruin.nl

"Newt" wrote in message ...
I would like to use a series of shapes to clear cells on a worksheet. For
example:

Shape1 exists in Cell A1. When clicked, it clears cells B1 and C1
Shape 2 exists in Cell A2. When clicked, it clears cells B2 and C2

and so on.

I need the references to be relative because I regularly re-sort the sheet
and the order of the shapes changes with all the cells. Basically, I want a
sub to figure out where the image is located and then clear the two adjacent
cells. Any ideas? Thanks!


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserted Shape Prints in Different Location on Sheet Dave Excel Discussion (Misc queries) 0 April 22nd 08 01:00 AM
Want to prevent users from changing location of shape textboxes [email protected] Excel Programming 0 May 2nd 06 04:04 PM
Shape Name and Location Report - an example [email protected] Excel Programming 1 April 1st 06 10:52 AM
Is it Possible to Find Shape at a Location (#find) for XL97? JK Excel Programming 4 March 16th 06 06:15 PM
Lock shape location to axis values? William DeLeo Charts and Charting in Excel 2 December 29th 05 01:09 PM


All times are GMT +1. The time now is 05:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"