VBA always offset to specific row

ShoYnn

Board Regular
Joined
Mar 20, 2019
Messages
60
Office Version
  1. 2016
Platform
  1. Windows
Just noticed title is wrong. Meant specific column, not row

I am attempting to have set of floating buttons in my sheet. I have managed to accomplish this with the following code:

With ActiveSheet.Shapes("shape name")
.Top = Target.Offset(1).Top
.Left = Target.Offset(, 1).Left
End With

Which works perfectly, but the issue is that I need most of the sheet to be locked and this throws an error if offset destination is in a locked cell. To "overcome" this I have dedicated a non-important range to the floating buttons and have it unlocked. The silly part now is that if the user does not click in the first column of that range it spits an error as at least one of the buttons moving will now be in the locked range.

My question, is there something I can use for the .Left part instead of offset that will always target say column N?

Thanks!
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
My question, is there something I can use for the .Left part instead of offset that will always target say column N?
Perhaps:
VBA Code:
.Left = Cells(Target.Row, "N").Left
 
Upvote 0
Solution
You're welcome, glad to help & thanks for the feedback.:)
 
Upvote 0

Forum statistics

Threads
1,213,552
Messages
6,114,278
Members
448,560
Latest member
Torchwood72

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