View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Xocial Xocial is offline
external usenet poster
 
Posts: 6
Default Macro VBA code to copy content from one worksheet to another

Hello. I have various worksheets in a workbook, each with 100 listed items
(B is description, C is price, D is availability - B1:B100, C1:C100,
D1:D100). I would to add checkboxes along A (A1:A100) where I can check, and
each time I check an item, that whole item with the various colums move to
another worksheet - lets call that worksheet SelectedCart (when I deselect an
item, it will disappear from SelectedCart). Also, I would each item added to
SelectedCart to be highlighted in different color (not sure if I should just
use Coditional Formatting).

I have a code that adds checkboxes and upon checking it adds date, but I am
not sure how I can do what I need (as listed above). Here is the code I have:

=================

Sub Process_CheckBox(pObject)

Dim LRow As Integer
Dim LRange As String

'Find row that checkbox resides in
LRow = pObject.TopLeftCell.Row
LRange = "B" & CStr(LRow)

'Change date in column B, if checkbox is checked
If pObject.Value = True Then
ActiveSheet.Range(LRange).Value = Date

'Clear date in column B, if checkbox is unchecked
Else
ActiveSheet.Range(LRange).Value = Null
End If

End Sub



Private Sub CheckBox1_Click()
Process_CheckBox CheckBox1
End Sub

Private Sub CheckBox2_Click()
Process_CheckBox CheckBox2
End Sub

Private Sub CheckBox3_Click()
Process_CheckBox CheckBox3
End Sub

Private Sub CheckBox4_Click()
Process_CheckBox CheckBox4
End Sub

Private Sub CheckBox5_Click()
Process_CheckBox CheckBox5
End Sub

Private Sub CheckBox6_Click()
Process_CheckBox CheckBox6
End Sub

Private Sub CheckBox7_Click()
Process_CheckBox CheckBox7
End Sub

=================

Any ideas where I can begin looking to do what I need? Thank you.