Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Further, if I remove the dot before the
Range("L2").Select It works, but not necessaarily on the right sheet. -----Original Message----- My worksheets are protected with UserModeOnly = True I have a piece of code With Worksheets(MySheet) .Cells.Select .Paste Application.CutCopyMode = False .Range("L4").Select .Range("J2,L2,L4").Select Selection.Replace _ What:="Sheet1", _ Replacement:=LinkTo, _ LookAt:=xlPart, _ SearchOrder:=xlByRows, _ MatchCase:=False .Range("L2").Select .Move Befo=Sheets(1) End With It stops on the ..Range("L2").Select with a Runtime Error 1004 - Protected and Read Only. BUt this cell is unlocked. If I move the ..Range("L4").Select before the ..Range("L2").Select it stops there insttead. If I move the ..Range("L2").Select before the ..Range("J2,L2,L4").Select it works, but not with the required behaviour. Can anyone tell me why it's stopping on a Range.Select ? Will a Cell.Select work where a Range.Select will mot ? Thanks, Don. . |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Why do you need to select L2 or L4 by themselves.
With Worksheets(MySheet) .Cells.Select .Paste Application.CutCopyMode = False .Range("J2,L2,L4").Replace _ What:="Sheet1", _ Replacement:=LinkTo, _ LookAt:=xlPart, _ SearchOrder:=xlByRows, _ MatchCase:=False .Move Befo=Sheets(1) End With Should still work the way you want it to. -- Regards, Tom Ogilvy "Don" wrote in message ... Further, if I remove the dot before the Range("L2").Select It works, but not necessaarily on the right sheet. -----Original Message----- My worksheets are protected with UserModeOnly = True I have a piece of code With Worksheets(MySheet) .Cells.Select .Paste Application.CutCopyMode = False .Range("L4").Select .Range("J2,L2,L4").Select Selection.Replace _ What:="Sheet1", _ Replacement:=LinkTo, _ LookAt:=xlPart, _ SearchOrder:=xlByRows, _ MatchCase:=False .Range("L2").Select .Move Befo=Sheets(1) End With It stops on the ..Range("L2").Select with a Runtime Error 1004 - Protected and Read Only. BUt this cell is unlocked. If I move the ..Range("L4").Select before the ..Range("L2").Select it stops there insttead. If I move the ..Range("L2").Select before the ..Range("J2,L2,L4").Select it works, but not with the required behaviour. Can anyone tell me why it's stopping on a Range.Select ? Will a Cell.Select work where a Range.Select will mot ? Thanks, Don. . |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Tom
The only reason I do any of this is beacause of a bug that prevents me from Copying more than 3 sheets in a Session, but the issue is not the Replace, it's the fact that things don't work even though I have UserModeOnly enabled. I even have a routine that invokes UserModeOnly in every Sub as a workaround to another bug. Don. -----Original Message----- Why do you need to select L2 or L4 by themselves. With Worksheets(MySheet) .Cells.Select .Paste Application.CutCopyMode = False .Range("J2,L2,L4").Replace _ What:="Sheet1", _ Replacement:=LinkTo, _ LookAt:=xlPart, _ SearchOrder:=xlByRows, _ MatchCase:=False .Move Befo=Sheets(1) End With Should still work the way you want it to. -- Regards, Tom Ogilvy "Don" wrote in message ... Further, if I remove the dot before the Range("L2").Select It works, but not necessaarily on the right sheet. -----Original Message----- My worksheets are protected with UserModeOnly = True I have a piece of code With Worksheets(MySheet) .Cells.Select .Paste Application.CutCopyMode = False .Range("L4").Select .Range("J2,L2,L4").Select Selection.Replace _ What:="Sheet1", _ Replacement:=LinkTo, _ LookAt:=xlPart, _ SearchOrder:=xlByRows, _ MatchCase:=False .Range("L2").Select .Move Befo=Sheets(1) End With It stops on the ..Range("L2").Select with a Runtime Error 1004 - Protected and Read Only. BUt this cell is unlocked. If I move the ..Range("L4").Select before the ..Range("L2").Select it stops there insttead. If I move the ..Range("L2").Select before the ..Range("J2,L2,L4").Select it works, but not with the required behaviour. Can anyone tell me why it's stopping on a Range.Select ? Will a Cell.Select work where a Range.Select will mot ? Thanks, Don. . . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Runtime Error 1004 | Excel Discussion (Misc queries) | |||
runtime error 1004 HELP PLS | Excel Discussion (Misc queries) | |||
runtime error '1004' | Excel Discussion (Misc queries) | |||
runtime error 1004 | Excel Discussion (Misc queries) | |||
runtime error 1004 | Excel Programming |