G
Guest
I have CommandButton that when you click on it, it triggers a Form with a
List and when you click on an value then it pastes the value from the list
into the selected cell (B5). Also it will check for the value in cell E1 in
the sheet named "formula" and then it will Offset 3 cell(E5). Here is the
problem, I want for the macro only to execute in the range on B5:B159 and if
not in range B5:B159 then a message would say something like "Select a Cell
in Column B".
I have columns D and F with formulas and if anyone chooses an unlocked
(column C, D or E) the 3dr cell changes even if it is locked. Here is a piece
of code of what I have at the moment. I really appreciate your response,
Thanks
Private Sub CommandButton1_Click()
If lstSelection.ListIndex = -1 Then
MsgBox "No item selected", vbExclamation
Exit Sub
End If
Range("SelectionLink") = lstSelection.ListIndex + 1
Selection.Cells(1) = Worksheets("Formulas").Range("D1")
Selection.Cells(1).Offset(0, 3) = Worksheets("Formulas").Range("E1")
Unload Me
End Sub
Private Sub CommandButton2_Click()
Unload Me
End Sub
Private Sub lstSelection_Click()
End Sub
Private Sub UserForm_Click()
End Sub
KBREnner
List and when you click on an value then it pastes the value from the list
into the selected cell (B5). Also it will check for the value in cell E1 in
the sheet named "formula" and then it will Offset 3 cell(E5). Here is the
problem, I want for the macro only to execute in the range on B5:B159 and if
not in range B5:B159 then a message would say something like "Select a Cell
in Column B".
I have columns D and F with formulas and if anyone chooses an unlocked
(column C, D or E) the 3dr cell changes even if it is locked. Here is a piece
of code of what I have at the moment. I really appreciate your response,
Thanks
Private Sub CommandButton1_Click()
If lstSelection.ListIndex = -1 Then
MsgBox "No item selected", vbExclamation
Exit Sub
End If
Range("SelectionLink") = lstSelection.ListIndex + 1
Selection.Cells(1) = Worksheets("Formulas").Range("D1")
Selection.Cells(1).Offset(0, 3) = Worksheets("Formulas").Range("E1")
Unload Me
End Sub
Private Sub CommandButton2_Click()
Unload Me
End Sub
Private Sub lstSelection_Click()
End Sub
Private Sub UserForm_Click()
End Sub
KBREnner