View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
GB GB is offline
external usenet poster
 
Posts: 230
Default Button location problem

What does the code look like that "moves" the button? (Assuming that's what
you recorded). With that, you could do a number of things:

1) Locate the row that needs to proceed after your button, determine the
difference between it's current position and the expected final position, and
use that calculation to duplicate the recorded move.
2) Create the button at the location needed (Try recording the full process
of creating the button at a location). Again would need to find the row and
then duplicate the creation attribute. (I think this creation process would
only be necessary if you are able to determine that the button has been wiped
from the sheet.)
3) Create "blank" worksheets (programatically very hidden) that mimic the
end product of each of the macros that create the worksheet such that the you
can copy the worksheet to a new worksheet, make it visible and then perform
the operation consistent with the expected macro. (Of course this would be a
very rigid fix to the problem because it would 1) require an additional very
hidden sheet for each type of operation, and 2) it assumes that the button
can only be located at the position(s) identified by each worksheet.

But by posting the code generated by the move, maybe some more help can be
given beyond my "discussion".

"Greg Snidow" wrote:

Greetings all. Need to be able to programatically set a command button's
position. On one sheet there is a button to run a macro that needs to always
be just above a certain row. The problem is that the certain row varies,
depending on the macro that created the sheet. I tried recording a macro to
put it where I want it, but in only increments it from its current position.
Is there a way to do this? Thank you.

Greg