ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Check Box (https://www.excelbanter.com/excel-programming/395647-check-box.html)

[email protected]

Check Box
 
I have a spreadsheet set up where you would check a check box and a
value will pop into a cell on another sheet. If you uncheck it the
value will disappear. I keep getting an error that says "Identifier
under cursor is not recognized". Its in the line where it selects a
range of cells. What i'm I missing here?

Private Sub CheckBox1_Click()

With CheckBox1
If .Value = True Then
Sheets("RENOVATION").Select
Range("B6:E6").Select
ActiveCell.FormulaR1C1 = "Leased"
Sheets("COVER").Select
Else
Sheets("RENOVATION").Select
Range("B6:E6").Select
Selection.ClearContents
Sheets("COVER").Select

End If
End With
End Sub


Dave Peterson

Check Box
 
I don't know. What is the under the cursor?

But I'd drop the selecting:

Option Explicit
Private Sub CheckBox1_Click()
With CheckBox1
If .Value = True Then
Worksheets("RENOVATION").Range("B6:E6").Value = "Leased"
Else
Worksheets("RENOVATION").Range("B6:E6").ClearConte nts
End If
End With
End Sub

wrote:

I have a spreadsheet set up where you would check a check box and a
value will pop into a cell on another sheet. If you uncheck it the
value will disappear. I keep getting an error that says "Identifier
under cursor is not recognized". Its in the line where it selects a
range of cells. What i'm I missing here?

Private Sub CheckBox1_Click()

With CheckBox1
If .Value = True Then
Sheets("RENOVATION").Select
Range("B6:E6").Select
ActiveCell.FormulaR1C1 = "Leased"
Sheets("COVER").Select
Else
Sheets("RENOVATION").Select
Range("B6:E6").Select
Selection.ClearContents
Sheets("COVER").Select

End If
End With
End Sub


--

Dave Peterson

[email protected]

Check Box
 
On Aug 16, 3:49 pm, Dave Peterson wrote:
I don't know. What is the under the cursor?

But I'd drop the selecting:

Option Explicit
Private Sub CheckBox1_Click()
With CheckBox1
If .Value = True Then
Worksheets("RENOVATION").Range("B6:E6").Value = "Leased"
Else
Worksheets("RENOVATION").Range("B6:E6").ClearConte nts
End If
End With
End Sub





wrote:

I have a spreadsheet set up where you would check a check box and a
value will pop into a cell on another sheet. If you uncheck it the
value will disappear. I keep getting an error that says "Identifier
under cursor is not recognized". Its in the line where it selects a
range of cells. What i'm I missing here?


Private Sub CheckBox1_Click()


With CheckBox1
If .Value = True Then
Sheets("RENOVATION").Select
Range("B6:E6").Select
ActiveCell.FormulaR1C1 = "Leased"
Sheets("COVER").Select
Else
Sheets("RENOVATION").Select
Range("B6:E6").Select
Selection.ClearContents
Sheets("COVER").Select


End If
End With
End Sub


--

Dave Peterson- Hide quoted text -

- Show quoted text -


Dave,

I'm not sure what the "under the cursor" is either. But the code you
provided help out a lot.

Thanks,
Keith


Michael

Check Box
 
This should correct the problem
Private Sub CheckBox1_Click()

With CheckBox1
If .Value = True Then
Sheets("RENOVATION").Select
Range("B6:E6").FormulaR1C1 = "Leased"
Sheets("COVER").Select
Else
Sheets("RENOVATION").Select
Range("B6:E6").ClearContents
Sheets("COVER").Select

End If
End With

End Sub
You don't need to select the ranges.

If this posting was helpful, please click on the Yes button.
Regards,

Michael Arch.




" wrote:

I have a spreadsheet set up where you would check a check box and a
value will pop into a cell on another sheet. If you uncheck it the
value will disappear. I keep getting an error that says "Identifier
under cursor is not recognized". Its in the line where it selects a
range of cells. What i'm I missing here?

Private Sub CheckBox1_Click()

With CheckBox1
If .Value = True Then
Sheets("RENOVATION").Select
Range("B6:E6").Select
ActiveCell.FormulaR1C1 = "Leased"
Sheets("COVER").Select
Else
Sheets("RENOVATION").Select
Range("B6:E6").Select
Selection.ClearContents
Sheets("COVER").Select

End If
End With
End Sub




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

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