Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
how to copy and paste in a protected worksheet
The following macro might help: Option Explicit Sub CopyUnlocked() Dim DestRow As Integer Dim sDestRow As String DestRow = Application.InputBox(Prompt:="Enter Destination Row", Title:="DestinationRow", Type:=1) Dim c As Range Dim d As Range Dim DestRange As Range Dim rng As Range Dim x As Integer x = 0 Range("$A$" & ActiveCell.Row).Select Set rng = ActiveCell Set c = ActiveCell Set DestRange = c.Offset(DestRow - c.Row, 0) Set d = c Do While c.Column < 257 Do Until (c.Locked) x = x + 1 [A1] = x [A2] = c.Column Set c = c.Offset(0, 1) If (c.Locked) Then Exit Do ' Exit the do until loop End If Set rng = Union(rng, c) If c.Column = 256 Then Exit Do ' exit the do until loop End If Loop rng.Copy 'Selection.Copy DestRange.PasteSpecial xlPasteValues Range("$A$" & DestRange.Row).Select If c.Column = 256 Then Exit Do ' exit the do WHILE loop End If Set c = c.Offset(0, 1) Set rng = c Set DestRange = c.Offset(DestRow - c.Row, 0) Loop End Sub -- CaptainQuattro ------------------------------------------------------------------------ CaptainQuattro's Profile: http://www.excelforum.com/member.php...o&userid=32763 View this thread: http://www.excelforum.com/showthread...hreadid=571191 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Copy & paste to protected sheet | Excel Discussion (Misc queries) | |||
allow me to copy and paste in a protected worksheet | New Users to Excel | |||
copy and paste from and to protected sheets | Excel Programming | |||
Copy/Paste a protected cell | Excel Discussion (Misc queries) | |||
Can't copy & paste row inside a protected worksheet | Excel Programming |