ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Locking panes (https://www.excelbanter.com/excel-programming/366174-locking-panes.html)

Nick London

Locking panes
 
I have a macro that does alot of things in a spreadsheet. I want the code to
lock the panes at a certain column. The coulmn is not the same every time so
I cannot simply record a macro but if a record a macro the code is:

Columns("F:F").Select
ActiveWindow.FreezePanes = True

Now I need to replace the first line with something else. I want to lock the
panes where at the column where the word "Securitiy ID" is found. There (with
some help) I wrote:

Set rng2 = Worksheets("Beräkning").Cells.Find("Security ID", LookIn:=xlValues)
......
Columns(rng2.Address).Select
ActiveWindow.FreezePanes = True

but this does not work. Please help me if you have any clue. Thanks!





DAV135

Locking panes
 
Cells.Find(What:="Security ID", After:=ActiveCell,
LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=False _
, SearchFormat:=False).Activate
Columns(ActiveCell.Column).Select
ActiveWindow.FreezePanes = True


*If that doesn't wory, check your spelling of Security, not sure if you
copied and pasted it but there was a spelling mistake!

Cheers



All times are GMT +1. The time now is 09:49 PM.

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