ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Check boxes (https://www.excelbanter.com/excel-programming/373693-check-boxes.html)

laura56

Check boxes
 
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

:)


Tim Williams

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

Tim

"laura56" wrote in message
oups.com...
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

:)




laura56

Check boxes
 

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?




Tim Williams wrote:

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

Tim

"laura56" wrote in message
oups.com...
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

:)



Bob Phillips

Check boxes
 
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)

"laura56" wrote in message
ps.com...

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?




Tim Williams wrote:

Maybe show your current code? It might be a simple modification of

that.
What type of checkboxes are you using?

Tim

"laura56" wrote in message
oups.com...
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

:)






All times are GMT +1. The time now is 09:27 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com