A little VBA help regarding a check box in a userform

Mav93

Board Regular
Joined
Feb 21, 2005
Messages
107
Hi everyone!!!!!

I have a user form that has a check box in it (actually it has several) and I would like to insert its caption into a blank cell somewhere between A1-A25. the Cells in this range may or may not have data already in them so I way to find the blank cells. If any one thinks that i'm barking up the wrong tree please let me know so I can try to move on to a different solution.


Thanks for any help in advance it truely is appreciated!!!!
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

onlyadrafter

Well-known Member
Joined
Aug 19, 2003
Messages
5,703
Platform
  1. Windows
Hello,


This will find the first blank cell from A1 downwards

Code:
Private Sub CheckBox1_Click()
For MY_ROWS = 1 To 25
    If IsEmpty(Range("A" & MY_ROWS).Value) Then
        Range("A" & MY_ROWS).Value = CheckBox1.Caption
        Exit Sub
End If
Next MY_ROWS
    MY_ENTRY = MsgBox("NO BLANK CELLS", vbOKOnly, "ERROR")
End Sub
 

Mav93

Board Regular
Joined
Feb 21, 2005
Messages
107
Thanks onlyadrafter for the code it works fine, but ( doesn't there always seem to be but) if a person were to go back to the userform and uncheck the check box is there anyway to remove the text that had been inserted into the cell

Thanks for the help in advance!!!!
 

Forum statistics

Threads
1,136,613
Messages
5,676,820
Members
419,653
Latest member
analyticalchemist94

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top