PDA

View Full Version : Some problems with checkbox



dzogchen
04-24-2007, 12:45 PM
Hello,

I?d like to develop a program in VB for Excel 2003, witch can do the following:

In sheet2 I?ll have, for example, 3 checkboxes. When the checkbox1 became True it should appear in the sheet1, for example in cell B2, a number. If checkbox2 became True it should appear a number in cell B3 and if checkbox3 became True a number should appear in cell B4, for example.

Trying to difficult the matter, I need that the first checkbox who became True (checkbox1, checkbox2 or chekcbox3) should make the number appear in cell B2, and the second checkbox who became True should make the number appear in cell B3, and so on.

This programs it?s to help me calculating the prices for some equipments in my job, and right now I?ll do it by the hand, witch I think that is a thing of the last centaury J.

I know also that my experience in VBA it?s not much, but I?ve search in the internet and in some books and I didn?t find any example for checkboxes doing this.

I?ll appreciate very much your help.

Thank you in advance.

Nuno Jesus

Aussiebear
04-24-2007, 03:23 PM
G'day dzogchen, Can you post your wokbook (or a sanitised version if possible) so we can see what you are looking at?

:friends:

dzogchen
04-25-2007, 10:28 AM
Hi Aussiebear, thank you for your reply!

Unfortunately I?m not able to post links yet.:dunno

This program in VB became a master case for me. :whistle:


Best Regards.

Nuno Jesus

dzogchen
04-25-2007, 10:29 AM
:devil2:

dzogchen
04-25-2007, 10:30 AM
:devil2::devil2:

dzogchen
04-25-2007, 10:32 AM
:devil2::devil2::devil2:

dzogchen
04-25-2007, 10:34 AM
Aussiebear,



This is one example that I?m trying to do.

http://www.megagaleria.com/pictures/Pic_4719_22.jpg

In sheet1 it should appear what I chose in sheet2. In sheet2 only checkboxes.


Best Regards.

Nuno Jesus

mdmackillop
04-25-2007, 11:48 PM
Hi Nuno,
You can post a workbook using Manage Attachments in the Go Advanced section

Aussiebear
04-26-2007, 12:19 AM
[quote=dzogchen]Aussiebear,



This is one example that I?m trying to do.

http://www.megagaleria.com/pictures/Pic_4719_22.jpg

In sheet1 it should appear what I chose in sheet2. In sheet2 only checkboxes.


Nuno, There are some really helpful people here on this forum, and to be brutally honest trying to read your worksheet image is like trying to read the logo on a golf ball at 50 mtrs.....

You really need to post your workbook or at least an example of your workbook, so people can assist you.

dzogchen
04-28-2007, 01:45 PM
Hello mdmackillop and Aussiebear.

Sorry for my last post. I?ll try to put an image that you can understand what I want to do.

Here is one example:

http://www.megagaleria.com/pictures/Pic_4719_23.jpg

http://www.megagaleria.com/pictures/Pic_4719_24.jpg

In Sheet2 I select the equipments that I want to calculate. In Sheet1 must appear the equipments that I select.

At the first time I thought that the easiest way is to put all the information (prices, border format, cell format) in VBA code but it?s necessary tons of data. But in another someone give me the idea to have another sheet for mapping. For example, in Sheet3 I have all the prices for all equipments, and selecting (in sheet2) the equipments that I want to calculate, the program must select the correspondent rows (in sheet3) and make a copy to Sheet1. That is the easiest way to do what I want.

As I told you before, I haven?t much experience in VBA, so right now I can?t generate a code to make multiple selections in sheet3. Can you help me with that?

Best regards.

Nuno Jesus

Aussiebear
04-28-2007, 06:01 PM
Whilst the images are fine, it would be really helpful for the workbook to be posted. That way we don't need to rebuild what you already have completed, and its easier for us to test any code we offer to you.

dzogchen
04-29-2007, 04:14 PM
Aussiebear, I didn't do much in my workbook, just some things to test. Here it is.

Private Sub CheckBox1_Click()
If CheckBox1 = True Then
Range("A4").Select
ActiveCell.EntireRow.Select
End If
End Sub

Private Sub CheckBox2_Click()
If CheckBox2 = True Then
Range("A5").Select
ActiveCell.EntireRow.Select
End If
End Sub

I worn you, I?m newbie in VBA!!!

But even so I don?t understand why the hell does this code don?t work if I add "Worksheets("Sheet3").Select" to work in another sheet


Private Sub CheckBox1_Click()
If CheckBox1 = True Then
Worksheets("Sheet3").Select
Range("A3").Select
ActiveCell.EntireRow.Select
End If
End Sub
(...)

Best regards

Nuno Jesus