View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Rockee052[_15_] Rockee052[_15_] is offline
external usenet poster
 
Posts: 1
Default UserForm / Protection??? :(

Hank,

Thanks for responding!!!!

I'm a newbie to vba so, i'm not sure how to place the coding.
Infact i'm not sure how to protect and unprotect with the user form. I
I understand your post correctly you were talking about protecting th
cells that the userform uses and leaving the cells that need to b
entered manually unprotected. So the user cant enter any data into th
cells unless they use the userform.
Here is my code for the userform, if you could lead me in the righ
direction I would really appreciate it.


Private Sub OKButton_Click()
On Error Resume Next
Dim activeRow As Integer
Dim activeCol As Integer
Dim errMsg As VbMsgBoxResult
Dim lindex As Integer
Dim ntoins As String
Dim wtoins As String
Dim nfound As Boolean

Dim rrow As Integer

activeRow = ActiveCell.Row
activeCol = ActiveCell.Column

lindex = ListBox.ListIndex
ntoins = ListBox.Column(0, lindex)
wtoins = ListBox.Column(1, lindex)
nfound = False

'has to start in bay 1
If activeCol < 2 Then
errMsg = MsgBox("Please select a cell in bay 1", vbExclamation
"Wrong Cell")
GoTo end_handler
End If

If frameBay.radio_1 = True Then
With ActiveSheet
.Cells(activeRow, 2) = ntoins
.Cells(activeRow, 7) = wtoins
End With
End If

If frameBay.radio_1 = True Then
rrow = 0
ElseIf frameBay.radio_2 = True Then
rrow = 6
ElseIf frameBay.radio_3 = True Then
rrow = 21
ElseIf frameBay.radio_4 = True Then
rrow = 40
End If

With ActiveSheet
If rrow < 0 Then
While nfound = False
If .Cells(rrow, 12).Value = "" Then
nfound = True
'insert the data
.Cells(rrow, 12).Value = ntoins
.Cells(rrow, 17).Value = wtoins
Else
rrow = rrow + 1
End If
Wend
End If
End With

end_handler:
'do nothing
End Su

--
Message posted from http://www.ExcelForum.com