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

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
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
 
Upvote 0
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!!!!
 
Upvote 0

Forum statistics

Threads
1,214,971
Messages
6,122,517
Members
449,088
Latest member
RandomExceller01

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
Back
Top