Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default check boxes in Excel - VBA Question

I am attempting to have Excel change a formula based on the status of a
check box contained on a sheet. The code I have is the following:

Private Sub CheckBoxFULL_Change()

Application.ScreenUpdating = False

Select Case CheckBoxFULL.Value

Case True

Sheets("CAL-SHEET").Select
Range("F36").Select
ActiveCell.FormulaR1C1 = "='Line Fit FULL CURVE'!RC[-4]"
Worksheets("Line Fit FULL CURVE").Activate
Range("B36").Select

Case False

Sheets("CAL-SHEET").Select
Range("F36").Select
ActiveCell.FormulaR1C1 = "=R[-23]C[24]"
Worksheets("Line Fit FULL CURVE").Activate
Range("B36").Select

End Select

Sheets("CAL-SHEET").Select

Application.ScreenUpdating = True

End Sub

But I keep getting:

Run-time error '1004'
Select method of Range class failed

on the "Range("F36").Select" line. Why is this not functioning
correctly? If I copy the code to a plain macro, it performs everything
correctly, but when running it as I do above, it errors out.

Thanks for any help/guidance!

Ken

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default check boxes in Excel - VBA Question

Private Sub CheckBoxFULL_Change()



Select Case CheckBoxFULL.Value

Case True

With Sheets("CAL-SHEET")
.Range("F36").FormulaR1C1 = _
"='Line Fit FULL CURVE'!RC[-4]"
End With

Case False

With Sheets("CAL-SHEET")
.Range("F36").FormulaR1C1 = _
"=R[-23]C[24]"

End Select

Worksheets("Line Fit FULL CURVE")
Worksheets("Line Fit FULL CURVE").Range("B36").Select



End Sub

--
Regards,
Tom Ogilvy

" wrote:

I am attempting to have Excel change a formula based on the status of a
check box contained on a sheet. The code I have is the following:

Private Sub CheckBoxFULL_Change()

Application.ScreenUpdating = False

Select Case CheckBoxFULL.Value

Case True

Sheets("CAL-SHEET").Select
Range("F36").Select
ActiveCell.FormulaR1C1 = "='Line Fit FULL CURVE'!RC[-4]"
Worksheets("Line Fit FULL CURVE").Activate
Range("B36").Select

Case False

Sheets("CAL-SHEET").Select
Range("F36").Select
ActiveCell.FormulaR1C1 = "=R[-23]C[24]"
Worksheets("Line Fit FULL CURVE").Activate
Range("B36").Select

End Select

Sheets("CAL-SHEET").Select

Application.ScreenUpdating = True

End Sub

But I keep getting:

Run-time error '1004'
Select method of Range class failed

on the "Range("F36").Select" line. Why is this not functioning
correctly? If I copy the code to a plain macro, it performs everything
correctly, but when running it as I do above, it errors out.

Thanks for any help/guidance!

Ken


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Check Boxes In Excel frpkaren Excel Discussion (Misc queries) 2 March 28th 07 09:18 AM
Check Boxes In Excel bigwheel Excel Discussion (Misc queries) 0 March 28th 07 01:13 AM
Check Boxes In Excel bigwheel Excel Discussion (Misc queries) 0 March 28th 07 12:19 AM
How do i set up check boxes in excel? Mountaintop Ryan New Users to Excel 1 August 17th 06 11:59 PM
Using Check boxes in Excel Louise Excel Worksheet Functions 4 April 4th 06 02:32 PM


All times are GMT +1. The time now is 05:32 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"