Object may need macro to control alignment inside cell

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In a spreadsheet there is an object D1: If a cell on the same line J1: expands and it now contains more lines, the object in D1 doesn' t keep it's alignment at the bottom of the cell D1.

Would a macro be able to contol this movement and what would the macro look like

Thanks in advance for any any help
 
Hi
AFAIK nothing you can do about this as objext 'float' over the cells.
They're not liked/bound to a cell

--
Regards
Frank Kabel
Frankfurt, Germany

gnet said:
In a spreadsheet there is an object D1: If a cell on the same line
J1: expands and it now contains more lines, the object in D1 doesn' t
keep it's alignment at the bottom of the cell D1.
 
Frank said:
Hi
AFAIK nothing you can do about this as objext 'float' over the cells.
They're not liked/bound to a cell



J1: expands and it now contains more lines, the object in D1 doesn' t
keep it's alignment at the bottom of the cell D1.

You can align the object with the cell boundaries by finding the
cell.left, top, height and width and assigning object.left, .width, etc.
It's a little bit of work, but can be done, and embedded into the
procedure that might make changes in the row height/column width so that
it is dynamic.

Q
 
gnet said:
In a spreadsheet there is an object D1: If a cell on the same line J1: expands and it now contains more lines, the object in D1 doesn' t keep it's alignment at the bottom of the cell D1.

Would a macro be able to contol this movement and what would the macro look like?

Thanks in advance for any any help.


Try pasting the following macro into the code module of the worksheet that
contains the Object. It will adjust the position of object whenever the entry
in cell J1 gets changed.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$J$1" Then
With ActiveSheet.Shapes("Object 1")
.Top = Target.Top + Target.Height - .Height
End With
End If
End Sub


Regards,
Vic Eldridge
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top