Check boxes

  • Thread starter Thread starter laura56
  • Start date Start date
L

laura56

Hi,

I want to use check boxes to select certain rows in the spreadsheet to
be transferred to the database. After these check boxes are selected,
I then want to use one "update" button to transfer to the database.

Currently, as you select each checkbox that row individually is
transferred. Does anyone know how to combine this using macros? I was
thinking something like a counter, but I am very inexperienced with VBA
so I'm not sure how/if it something like this can be done?

Any help much appreciated.

Thanks

:)
 
Maybe show your current code? It might be a simple modification of that.
What type of checkboxes are you using?

Tim
 
I have 17 check boxes (which I created using the control toolbox) that
are coded similarly to this:


Private Sub CheckBox1_Change()
Range("B4").Select

If CheckBox1.Value = False Then
Range("A1").Select
Else
Call checkBox
End If
End Sub



Sub checkBox()

ProjectID = ActiveCell.Value
ProjectTitle = ActiveCell.Range("B1").Value
ProjectDate = ActiveCell.Range("C1").Value
ProjectColour = ActiveCell.Range("D1").Value
ProjectFile = ActiveCell.Range("E1").Value
ProjectSummary = ActiveCell.Range("F1").Value

Sql = "insert into PROJECT (ID, TITLE, DATE, COLOUR, LINK, SUMMARY)
values ('" & ProjectID & "','" & ProjectTitle & "','" & ProjectDate &
"','" & ProjectColour & "','" & ProjectFile & "','" & ProjectSummary &
"')"

....
<this then has connections to the database and executes the above SQL
query correctly>
....

End Sub


Is this what you were asking for?
 
Add a commandbutton and within that button's code check each checkbox

If CheckBox1.Value Then 'transfer that data
If CheckBox2.Value Then 'transfer that data

etc.

It is difficult to gauge from your code as I cannot see how checkbox1 copies
different data to Checkbox 2.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top