Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The command:
SpecialCells(xlLastCell).Select fails if my worksheet is protected. Is there any way round this without resorting to unprotecting the sheet (I don't want to have to hard code the password in my macro)? Thanks TM |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Oh it's OK, just found the answer in the archive :-) Duh!
myLastCol = _ ..Cells.Find("*", After:=.Cells(1), _ LookIn:=xlFormulas, LookAt:=xlWhole, _ SearchDirection:=xlPrevious, _ SearchOrder:=xlByColumns).Column Thanks anyway TM "TishyMouse" wrote: The command: SpecialCells(xlLastCell).Select fails if my worksheet is protected. Is there any way round this without resorting to unprotecting the sheet (I don't want to have to hard code the password in my macro)? Thanks TM |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
mylastCol = cells.specialcells(xlLastcell).Column
-- Regards, Tom Ogilvy "TishyMouse" wrote: Oh it's OK, just found the answer in the archive :-) Duh! myLastCol = _ .Cells.Find("*", After:=.Cells(1), _ LookIn:=xlFormulas, LookAt:=xlWhole, _ SearchDirection:=xlPrevious, _ SearchOrder:=xlByColumns).Column Thanks anyway TM "TishyMouse" wrote: The command: SpecialCells(xlLastCell).Select fails if my worksheet is protected. Is there any way round this without resorting to unprotecting the sheet (I don't want to have to hard code the password in my macro)? Thanks TM |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
THanks, Tom, but that is the command that I was trying originally doesn't
seem to work on a protected sheet. The 'find' method works fine, it's just a bit longer. "Tom Ogilvy" wrote: mylastCol = cells.specialcells(xlLastcell).Column -- Regards, Tom Ogilvy "TishyMouse" wrote: Oh it's OK, just found the answer in the archive :-) Duh! myLastCol = _ .Cells.Find("*", After:=.Cells(1), _ LookIn:=xlFormulas, LookAt:=xlWhole, _ SearchDirection:=xlPrevious, _ SearchOrder:=xlByColumns).Column Thanks anyway TM "TishyMouse" wrote: The command: SpecialCells(xlLastCell).Select fails if my worksheet is protected. Is there any way round this without resorting to unprotecting the sheet (I don't want to have to hard code the password in my macro)? Thanks TM |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub ABC()
ActiveSheet.Protect UserInterfaceOnly:=True Set rng = ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell) lastcol = rng.Column MsgBox lastcol End Sub worked fine for me on a protected sheet. If it is password protected, in xl2002 and later you would have to supply the password. -- Regards, Tom Ogilvy "TishyMouse" wrote: THanks, Tom, but that is the command that I was trying originally doesn't seem to work on a protected sheet. The 'find' method works fine, it's just a bit longer. "Tom Ogilvy" wrote: mylastCol = cells.specialcells(xlLastcell).Column -- Regards, Tom Ogilvy "TishyMouse" wrote: Oh it's OK, just found the answer in the archive :-) Duh! myLastCol = _ .Cells.Find("*", After:=.Cells(1), _ LookIn:=xlFormulas, LookAt:=xlWhole, _ SearchDirection:=xlPrevious, _ SearchOrder:=xlByColumns).Column Thanks anyway TM "TishyMouse" wrote: The command: SpecialCells(xlLastCell).Select fails if my worksheet is protected. Is there any way round this without resorting to unprotecting the sheet (I don't want to have to hard code the password in my macro)? Thanks TM |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Change cell color in protected sheet | Excel Worksheet Functions | |||
how to paste a fomulae cell in a protected sheet | Excel Programming | |||
finding the password to unlock a protected cell/chart | Charts and Charting in Excel | |||
Can I allow cell merging in a protected sheet | Excel Worksheet Functions | |||
Un-proteced Cell in a Protected Sheet | Excel Discussion (Misc queries) |