ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   excel error (https://www.excelbanter.com/excel-programming/285550-excel-error.html)

steve

excel error
 
I have been writing an excel/vba application and have run
into problems when making changes.

On start up I present a form to the user to choose how
they would like to input data, according to the choice the
spreadsheet displays cells in a certain way.

Inevitably the requirements have changed so that the input
choices can be made at any time, not only on start up.

Basically the code now fails when I hook it up to on sheet
buttons. Why would this be? Presumably some initialisation
problem that I have overlooked?

Code examples....from the form - these methods fail if I
move them to buttons on the sheet itself.

Private Sub TenInputsOptionButton_Click()
InitialisationModle.alterSheetTenInputs
End Sub

Private Sub ThreeInputOptionButton_Click()
InitialisationModule.alterSheetThreeInputs
End Sub

....and this is the specific code that falls over

'reveals an area of cells that was previously hidden
'the previous font and interior colours are restored
'Rng is an object that specifies the Range of cells that
will be affected
'Default_Value is an integer or double specifies the
default value of the cells
Private Sub Reveal_Cells(Rng As Range, Default_Value As
Variant)
Rng.Interior.ColorIndex = 19
Rng.Font.ColorIndex = 5
Rng.Value = Default_Value
End Sub
----------------------------------------------------------
advice welcome

Steve



Tom Ogilvy

excel error
 
Try removing the Private and see if it resolves.

--
Regards,
Tom Ogilvy

"Steve" wrote in message
...
I have been writing an excel/vba application and have run
into problems when making changes.

On start up I present a form to the user to choose how
they would like to input data, according to the choice the
spreadsheet displays cells in a certain way.

Inevitably the requirements have changed so that the input
choices can be made at any time, not only on start up.

Basically the code now fails when I hook it up to on sheet
buttons. Why would this be? Presumably some initialisation
problem that I have overlooked?

Code examples....from the form - these methods fail if I
move them to buttons on the sheet itself.

Private Sub TenInputsOptionButton_Click()
InitialisationModle.alterSheetTenInputs
End Sub

Private Sub ThreeInputOptionButton_Click()
InitialisationModule.alterSheetThreeInputs
End Sub

...and this is the specific code that falls over

'reveals an area of cells that was previously hidden
'the previous font and interior colours are restored
'Rng is an object that specifies the Range of cells that
will be affected
'Default_Value is an integer or double specifies the
default value of the cells
Private Sub Reveal_Cells(Rng As Range, Default_Value As
Variant)
Rng.Interior.ColorIndex = 19
Rng.Font.ColorIndex = 5
Rng.Value = Default_Value
End Sub
----------------------------------------------------------
advice welcome

Steve






All times are GMT +1. The time now is 02:12 PM.

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