Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Checkbox problem
Hi all,
I have a problem, I'm trying to modify the visible property or the value in a checkbox inside a worksheet through a macro; I found in the F1 help of MS Excel the way to do this, my code is like this: Sub FiltrarBandas() Sheets("HojaBase").CheckBoxes.Value = xlOff Worksheets("HojaBase").OLEObjects("CheckBox6").Val ue = True End Sub But Excel gives me the error 1004 that the OLEObjects property cannot be called from the WorkSheet class. Do anyone knows how can I modify the checkbox properties from a macro?? Thank you very much!! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Checkbox problem
hi
i got an error too but i did get this line to work..... Worksheets("HojaBase").CheckBox6.Value = True Regards FSt1 "japfvg" wrote: Hi all, I have a problem, I'm trying to modify the visible property or the value in a checkbox inside a worksheet through a macro; I found in the F1 help of MS Excel the way to do this, my code is like this: Sub FiltrarBandas() Sheets("HojaBase").CheckBoxes.Value = xlOff Worksheets("HojaBase").OLEObjects("CheckBox6").Val ue = True End Sub But Excel gives me the error 1004 that the OLEObjects property cannot be called from the WorkSheet class. Do anyone knows how can I modify the checkbox properties from a macro?? Thank you very much!! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Checkbox problem
Have you tried
Worksheets("HojaBase").Shapes("CheckBox6").Value = True "japfvg" wrote: Hi all, I have a problem, I'm trying to modify the visible property or the value in a checkbox inside a worksheet through a macro; I found in the F1 help of MS Excel the way to do this, my code is like this: Sub FiltrarBandas() Sheets("HojaBase").CheckBoxes.Value = xlOff Worksheets("HojaBase").OLEObjects("CheckBox6").Val ue = True End Sub But Excel gives me the error 1004 that the OLEObjects property cannot be called from the WorkSheet class. Do anyone knows how can I modify the checkbox properties from a macro?? Thank you very much!! |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Checkbox problem
It looks like you're mixing code for checkboxes from the Forms toolbar with code
for checkboxes from the control toolbox toolbar. I'm guessing that this was not your intention. That first line: Worksheets("HojaBase").CheckBoxes.Value = xlOff is for checkboxes from the Forms toolbar. If those are what you're really using, try: Worksheets("HojaBase").checkboxes("Check Box 6").Value = xlon ======== Unless you've renamed those Forms checkboxes, they'll have names like: Check Box 1 Check Box 2 .... Check Box 99 The Checkboxes from the Control toolbox toolbar have names like: Checkbox1 Checkbox2 .... Checkbox99 ============= If you're really using checkboxes from the control toolbox toolbar: Option Explicit Sub FiltrarBandas() Dim OLEObj As OLEObject For Each OLEObj In Worksheets("HojaBase").OLEObjects If TypeOf OLEObj.Object Is MSForms.CheckBox Then If LCase(OLEObj.Name) = LCase("checkbox6") Then OLEObj.Object.Value = True Else OLEObj.Object.Value = False End If End If Next OLEObj End Sub japfvg wrote: Hi all, I have a problem, I'm trying to modify the visible property or the value in a checkbox inside a worksheet through a macro; I found in the F1 help of MS Excel the way to do this, my code is like this: Sub FiltrarBandas() Sheets("HojaBase").CheckBoxes.Value = xlOff Worksheets("HojaBase").OLEObjects("CheckBox6").Val ue = True End Sub But Excel gives me the error 1004 that the OLEObjects property cannot be called from the WorkSheet class. Do anyone knows how can I modify the checkbox properties from a macro?? Thank you very much!! -- Dave Peterson |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Checkbox problem
Thank you for this answer but Excel told that this object doesn't acept the
property value. "Barb Reinhardt" wrote: Have you tried Worksheets("HojaBase").Shapes("CheckBox6").Value = True "japfvg" wrote: Hi all, I have a problem, I'm trying to modify the visible property or the value in a checkbox inside a worksheet through a macro; I found in the F1 help of MS Excel the way to do this, my code is like this: Sub FiltrarBandas() Sheets("HojaBase").CheckBoxes.Value = xlOff Worksheets("HojaBase").OLEObjects("CheckBox6").Val ue = True End Sub But Excel gives me the error 1004 that the OLEObjects property cannot be called from the WorkSheet class. Do anyone knows how can I modify the checkbox properties from a macro?? Thank you very much!! |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Checkbox problem
Thank you very much, you were right, I was mixing but I used the method for
the forms toolbar and it worked. Thanks a lot again "Dave Peterson" wrote: It looks like you're mixing code for checkboxes from the Forms toolbar with code for checkboxes from the control toolbox toolbar. I'm guessing that this was not your intention. That first line: Worksheets("HojaBase").CheckBoxes.Value = xlOff is for checkboxes from the Forms toolbar. If those are what you're really using, try: Worksheets("HojaBase").checkboxes("Check Box 6").Value = xlon ======== Unless you've renamed those Forms checkboxes, they'll have names like: Check Box 1 Check Box 2 .... Check Box 99 The Checkboxes from the Control toolbox toolbar have names like: Checkbox1 Checkbox2 .... Checkbox99 ============= If you're really using checkboxes from the control toolbox toolbar: Option Explicit Sub FiltrarBandas() Dim OLEObj As OLEObject For Each OLEObj In Worksheets("HojaBase").OLEObjects If TypeOf OLEObj.Object Is MSForms.CheckBox Then If LCase(OLEObj.Name) = LCase("checkbox6") Then OLEObj.Object.Value = True Else OLEObj.Object.Value = False End If End If Next OLEObj End Sub japfvg wrote: Hi all, I have a problem, I'm trying to modify the visible property or the value in a checkbox inside a worksheet through a macro; I found in the F1 help of MS Excel the way to do this, my code is like this: Sub FiltrarBandas() Sheets("HojaBase").CheckBoxes.Value = xlOff Worksheets("HojaBase").OLEObjects("CheckBox6").Val ue = True End Sub But Excel gives me the error 1004 that the OLEObjects property cannot be called from the WorkSheet class. Do anyone knows how can I modify the checkbox properties from a macro?? Thank you very much!! -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Checkbox Problem, Please Help! | Excel Programming | |||
Checkbox problem | Excel Programming | |||
problem with checkbox control | Excel Worksheet Functions | |||
Checkbox problem | Excel Programming | |||
Checkbox problem | Excel Programming |