ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   Floating object? (https://www.excelbanter.com/new-users-excel/126880-floating-object.html)

Anand vijay

Floating object?
 
How do i make an object float in the worksheet?

Chip Pearson

Floating object?
 
It depends on the object and what you really mean by "float". Details count.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)

"Anand vijay" wrote in message
...
How do i make an object float in the worksheet?




Max

Floating object?
 
"Anand vijay" wrote:
How do i make an object float in the worksheet?


This sample from my archives illustrates an example
using code by Orlando Magalhaes Filho:
http://savefile.com/files/230799
Floating Textbox Example.xls
(full details inside, nicely rendered)

The notes inside: ..
or making use of a Floating text Box.


In this sample file, the demo "text box 1" in Sheet1 -- with the
eye-catching classic Ferrari thrown in as a bonus <g -- will remain fixed in
the top left corner when we scroll down or across the sheet (test this out!)

I played with some past code by Orlando Magalhaes Filho (below)
and it seems to do the above nicely

Steps:
Draw a text box (default named:"Text Box 1") on the sheet first
[Or insert a picture, then rename it as: Text Box 1]

Then install the code by right-clicking on sheet tab View code
then copy n paste Orlando's code into the code window
[ Adjust the x, y offsets to suit - I set these arbitrarily to 10]

'---
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
'by Orlando Magalhaes Filho in .programming
x_offset = 10
y_offset = 10
ActiveSheet.Shapes("Text Box 1").Select
With Cells(ActiveWindow.Panes(1).ScrollRow, _
ActiveWindow.Panes(1).ScrollColumn)
xpos = .Left + x_offset
ypos = .Top + y_offset
End With
With Selection
.Left = xpos
.Top = ypos
End With
Target.Select
End Sub
'---
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---


All times are GMT +1. The time now is 04:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com