Text box that moves when scrolling

glad_ir

Board Regular
Joined
Nov 22, 2020
Messages
143
Office Version
  1. 2010
Platform
  1. Windows
Hello everybody,

I’m hoping for some help please. I’d like to achieve a text box or text in a row that centres on the screen as the user scrolls horizontally but moves with the row when they scroll vertically.
Is this even achievable? Any thoughts much appreciated.

thank you, Iain
 
I'm not following what you want.
Moving the TextBox with the active cell is easy.
But now you have got into a lot of different ranges and I see no logical pattern to the Ranges.
And you said:
H6 and H15 the Text box will move to H5 etc?
Etc. means there are more

But without seeing a pattern I have no way of knowing what etc. might be.
And you said:
I'll try to explain what I'm trying to achieve.....I have a sheet which contains a number of series of objects.

What are objects. When I think of objects it might be a TextBox a SpinButton a ComboBox etc.
 
Upvote 0

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Hi, Sorry I'm not being very clear here . I have a title in cell C5 for a series of objects and cells the user needs to populate in the range C6:FG15. The user will paste a shape into range C6:H10, then add some data into cells H12, H14, H16 relevant to the object. They will then paste a second object in range AC6:AH10 and add some data to AH12, AH14, AH16.....then paste a 3rd object into BC6:BH10 and so on. As the user scrolls across the screen to make the entries the title in C5 will move out of sight. What I'd like to achieve is a title that remains in row 5 but moves horizontally to be directly above the cell the user is populating.....i.e. if they select cell AH12, AH14 or AH16 the title will move to column AH5, if they select BH14 the title will move to BH5. Does that make more sense? Thanks for your patience...
 
Upvote 0
Try this:
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Modified  11/25/2020  8:29:29 AM  EST
With TextBox1
    .Left = ActiveCell.Left
    .Top = Cells(5, 1).Top
End With

End Sub
 
Upvote 0
Solution
Try this:
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Modified  11/25/2020  8:29:29 AM  EST
With TextBox1
    .Left = ActiveCell.Left
    .Top = Cells(5, 1).Top
End With

End Sub
This is perfect - exactly what I was hoping for!! Thank you so much and sorry again for my poor articulation of the problem statement. I really appreciate your help. cheers, Iain
 
Upvote 0
This is perfect - exactly what I was hoping for!! Thank you so much and sorry again for my poor articulation of the problem statement. I really appreciate your help. cheers, Iain
Glad I was able to help you.
Come back here to Mr. Excel next time you need additional assistance.
 
Upvote 0

Forum statistics

Threads
1,215,322
Messages
6,124,241
Members
449,149
Latest member
mwdbActuary

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top