PC Review


Reply
Thread Tools Rate Thread

Control Toolbox Checkbox Macro - Help Please!

 
 
Tealina.Mairs@gmail.com
Guest
Posts: n/a
 
      22nd Dec 2006
I am trying to write a code that when the Copy Prior Line checkbox is
clicked, it copies the line two rows above and paste special (values
only) into the same line as the checkbox (i.e. copies line 27 into line
29). But I want to make one general macro that I can apply to every
Copy Prior Line checkbox, but I seem to have to use a line number...
Please help!

Also, can I apply this macro to every checkbox? Thank you and I really
appreciate the help...


Private Sub CheckBox2_Click()


Dim k As Integer


If CheckBox2.Value = True Then


Application.ScreenUpdating = False


With Range("B27:B300")


For k = 29 To 300


If Range("B" & k) = "True" Then
Range("B" & k - 2, "BI" & k - 2).Select
Range("B" & k - 2, "BI" & k - 2).Copy
Range("B" & k, "BI" & k).Select
Selection.PasteSpecial xlPasteValues
Application.CutCopyMode = False
Range("B" & k).Select


Else: GoTo 10
End If


Next k


10


End With


End If


End Sub

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Checkbox from control toolbar macro =?Utf-8?B?UGF0cmljayBCYXRlbWFu?= Microsoft Excel Programming 6 5th Nov 2007 10:47 AM
Getting control toolbox button to record a macro. =?Utf-8?B?c3Vlaw==?= Microsoft Excel Misc 2 19th Oct 2007 12:02 AM
How do I Enlarge the tick mark checkbox - from control toolbox? =?Utf-8?B?Y2hld3k=?= Microsoft Word Document Management 1 3rd Oct 2006 01:52 AM
HOW DO I GIVE A CONTROL TOOLBOX CHECKBOX A VALUE IN EXCEL? =?Utf-8?B?UGF1bGE=?= Microsoft Excel Worksheet Functions 0 6th Mar 2006 04:31 PM
Controls Toolbox control vs Form Toolbox control =?Utf-8?B?VG9ueV9WQkFDb2Rlcg==?= Microsoft Excel Programming 3 28th Jan 2005 08:30 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:53 AM.