![]() |
CheckBox Code to copy & paste range
Mobys of VBA, I 'm trying to write what I assumed was a simple copy & paste procedure using a checkbox value as the trigger. I have tried numerous variations, but to no avail. I get no error messages, I also get no desired results, except that everytime I run the code it does unprotect and protect the worksheet and it always clears the contents of rng2. The two named ranges (rng1 & rng2) are unprotected and the same size and configuration (i.e. A20:A22, A43:A45 respectively) , but they are on different sheets. Thanks for any help Here is my best code to date: Option Explicit Private Sub ChkboxRFP_Click() Dim i As Boolean Dim rng1 As Range Dim rng2 As Range Set rng1 = Sheets("Name Sheet").Range("RFPMsgSource") Set rng2 = ActiveSheet.Range("RFPMsgDestination") i = CheckBox1.Value ActiveSheet.Unprotect ("geekk") If i = True Then rng2.ClearContents 'Clear old text rng1.Copy rng2.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False ElseIf i = False Then rng2.ClearContents End If ActiveSheet.Protect ("geekk") End Sub -- Casey ------------------------------------------------------------------------ Casey's Profile: http://www.excelforum.com/member.php...fo&userid=4545 View this thread: http://www.excelforum.com/showthread...hreadid=475905 |
All times are GMT +1. The time now is 03:33 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com