siva.apps123
09-28-2017, 11:15 AM
Hello all..
I am new to VBA and this forum too.i am working on a report and i am able to send c,e fields from column a to column b by using active x controls but i dont know how do it by using"form controls".can someone tell that please .thank you very much
column a
column b
a
c
b
e
d
f
i am enclosing vba code i used...
Sub Workbook_Open()
With Sheet4.ListBox1
row_review = 0
Dim sheet As Worksheet
Set sheet = Sheets("Customization")
ListBox1.Clear
Do
DoEvents
row_review = row_review + 1
item_in_review = sheet.Range("D" & row_review)
If Len(item_in_review) > 0 Then ListBox1.AddItem (item_in_review)
Loop Until item_in_review = ""
End With
End Sub
Sub MoveAllLeft_Click()[/FONT][/COLOR]
Dim iCnt As Integer[/FONT][/COLOR]
'Move allItems from ListBox2 to ListBox1
For iCnt = 0 To Me.ListBox2.ListCount - 1
Me.ListBox1.AddItem Me.ListBox2.List(iCnt)
Next iCnt
'Clear ListBox1 After moving Items from ListBox1 to ListBox2
Me.ListBox2.Clear
End Sub
Sub MoveAllRight_Click()
Dim iCnt As Integer
'Move all Items from ListBox1 to ListBox2
For iCnt = 0 To Me.ListBox1.ListCount - 1
Me.ListBox2.AddItem Me.ListBox1.List(iCnt)
Next iCnt
'Clear ListBox1 After moving Items from ListBox1 to ListBox2
Me.ListBox1.Clear
End Sub
Sub MoveSelRight_Click()
Dim iCnt As Integer
'Move Selected Items from Listbox1 to Listbox2
For iCnt = 0 To Me.ListBox1.ListCount - 1
If Me.ListBox1.Selected(iCnt) = True Then
Me.ListBox2.AddItem Me.ListBox1.List(iCnt)
End If
Next
For iCnt = Me.ListBox1.ListCount - 1 To 0 Step -1
If Me.ListBox1.Selected(iCnt) = True Then
Me.ListBox1.RemoveItem iCnt
End If
Next
End Sub
Sub MoveSelLeft_Click()
Dim iCnt As Integer
'Move Selected Items from Listbox1 to Listbox2
For iCnt = 0 To Me.ListBox2.ListCount - 1
If Me.ListBox2.Selected(iCnt) = True Then
Me.ListBox1.AddItem Me.ListBox2.List(iCnt)
End If
Next
For iCnt = Me.ListBox2.ListCount - 1 To 0 Step -1
If Me.ListBox2.Selected(iCnt) = True Then
Me.ListBox2.RemoveItem iCnt
End If
Next
End Sub
I am new to VBA and this forum too.i am working on a report and i am able to send c,e fields from column a to column b by using active x controls but i dont know how do it by using"form controls".can someone tell that please .thank you very much
column a
column b
a
c
b
e
d
f
i am enclosing vba code i used...
Sub Workbook_Open()
With Sheet4.ListBox1
row_review = 0
Dim sheet As Worksheet
Set sheet = Sheets("Customization")
ListBox1.Clear
Do
DoEvents
row_review = row_review + 1
item_in_review = sheet.Range("D" & row_review)
If Len(item_in_review) > 0 Then ListBox1.AddItem (item_in_review)
Loop Until item_in_review = ""
End With
End Sub
Sub MoveAllLeft_Click()[/FONT][/COLOR]
Dim iCnt As Integer[/FONT][/COLOR]
'Move allItems from ListBox2 to ListBox1
For iCnt = 0 To Me.ListBox2.ListCount - 1
Me.ListBox1.AddItem Me.ListBox2.List(iCnt)
Next iCnt
'Clear ListBox1 After moving Items from ListBox1 to ListBox2
Me.ListBox2.Clear
End Sub
Sub MoveAllRight_Click()
Dim iCnt As Integer
'Move all Items from ListBox1 to ListBox2
For iCnt = 0 To Me.ListBox1.ListCount - 1
Me.ListBox2.AddItem Me.ListBox1.List(iCnt)
Next iCnt
'Clear ListBox1 After moving Items from ListBox1 to ListBox2
Me.ListBox1.Clear
End Sub
Sub MoveSelRight_Click()
Dim iCnt As Integer
'Move Selected Items from Listbox1 to Listbox2
For iCnt = 0 To Me.ListBox1.ListCount - 1
If Me.ListBox1.Selected(iCnt) = True Then
Me.ListBox2.AddItem Me.ListBox1.List(iCnt)
End If
Next
For iCnt = Me.ListBox1.ListCount - 1 To 0 Step -1
If Me.ListBox1.Selected(iCnt) = True Then
Me.ListBox1.RemoveItem iCnt
End If
Next
End Sub
Sub MoveSelLeft_Click()
Dim iCnt As Integer
'Move Selected Items from Listbox1 to Listbox2
For iCnt = 0 To Me.ListBox2.ListCount - 1
If Me.ListBox2.Selected(iCnt) = True Then
Me.ListBox1.AddItem Me.ListBox2.List(iCnt)
End If
Next
For iCnt = Me.ListBox2.ListCount - 1 To 0 Step -1
If Me.ListBox2.Selected(iCnt) = True Then
Me.ListBox2.RemoveItem iCnt
End If
Next
End Sub