Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy & paste to protected sheet nc Excel Discussion (Misc queries) 3 July 5th 09 10:38 PM
allow me to copy and paste in a protected worksheet George New Users to Excel 3 August 13th 06 08:11 PM
copy and paste from and to protected sheets Tonso Excel Programming 1 June 23rd 06 06:40 PM
Copy/Paste a protected cell Nat1 Excel Discussion (Misc queries) 3 August 8th 05 07:23 PM
Can't copy & paste row inside a protected worksheet giloboy Excel Programming 6 September 21st 04 06:43 PM


All times are GMT +1. The time now is 12:04 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"