Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Casey
 
Posts: n/a
Default 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

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
Can't Copy and Paste or Paste Special between Excel Workbooks wllee Excel Discussion (Misc queries) 5 April 29th 23 03:43 AM
copy and paste code problem bigdaddy3 Excel Worksheet Functions 10 September 21st 05 05:55 PM
Copy Paste Special Macro Bud Hughes Excel Discussion (Misc queries) 2 August 31st 05 02:00 AM
Locating variable range to copy Eric C New Users to Excel 3 August 12th 05 10:23 AM
copy paste cell character limit Fred Excel Discussion (Misc queries) 1 December 2nd 04 09:58 PM


All times are GMT +1. The time now is 09:40 PM.

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"