|
-
Jan 20th, 2004, 12:41 AM
#1
Thread Starter
New Member
Excel populating cells RESOLVED
Hi All,
First of all let me say that I am very new to VBA, so please bear with me.
I have a multipage that consists of 4 tabs. Each of the tabs contains various checkbox's ( between 4 & 6 box's each tab). When the user checks a box and then clicks the submit button it will populate the cells with the info. from the chkBox.
However, depending on which box's are checked (ex. 1, 3, 7, 9) there are blank cells between the populated cells (2,4,5,6,8).
So, how do I get it so that there are no empty cells. In other words I want all the cells in a column to have no blanks.
The other question is:
How do I read the populated cells (from the column above) into an array. I would like to use the data in the populated cells as labels on a different section of the form.
I hope this is clear and sorry for the long post.
Thanks.
Last edited by ittybitty; Feb 12th, 2004 at 11:37 PM.
-
Jan 22nd, 2004, 05:27 AM
#2
Addicted Member
Something like this :-
'---------------------------------------------
Private Sub CommandButton1_Click()
Dim ctl As MSForms.Control
Dim MyArray(9)
torow = 1
For Each ctl In Me.Controls
If TypeName(ctl) = "CheckBox" Then
If ctl.Value = True Then
ActiveSheet.Cells(torow, 1).Value _
= ctl.Caption
MyArray(torow) = ctl.Caption
torow = torow + 1
End If
End If
Next ctl
For n = 1 To 9
ActiveSheet.Cells(n, 2).Value = MyArray(n)
Next
End Sub
'------------------------------------------------------
Regards
BrianB
-------------------------------
-
Feb 5th, 2004, 01:31 PM
#3
Thread Starter
New Member
Thanks for the reply. I'll give it a try after lunch.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|