Hello, so tbh I’m very new at this, in fact I just started using VBA yesterday. I’m trying to create a form that inserts new data into another sheet by a push of a macro enabled button. This part I’ve actually already accomplished.
What I’d like to do with the button is to only enable it when someone changes the date on the form, and once it’s been pressed, disable it again so only one entry per new date is allowed for this form, to avoid duplicate data.
Below is where I have ended up so far. This doesn’t seem to work at all haha.
I have even gone as far as replacing the If Target.Addess = “$C$7” with If range (“$C$7”).value = 10 and just input a value of 10 in C7, and this doesn’t seem to even disable the button.
So again, changing the cell with the date would enable the button, and the action of pressing the button itself would once again disable the button, is what I’m hoping.
FYI, LOGFORM, is the name of the form control command button.
Private Sub Worksheet Change(ByVal Target As Range)
If Target.Address= "$C$7" Then
Sheets("Sheet12").LOGFORM.Enabled = True
Else
Sheets("Sheet12").LOGFORM.Enabled = False
End If
End Sub
—————————————————————
Private Sub CommandButton1 Click()
End Sub
What I’d like to do with the button is to only enable it when someone changes the date on the form, and once it’s been pressed, disable it again so only one entry per new date is allowed for this form, to avoid duplicate data.
Below is where I have ended up so far. This doesn’t seem to work at all haha.
I have even gone as far as replacing the If Target.Addess = “$C$7” with If range (“$C$7”).value = 10 and just input a value of 10 in C7, and this doesn’t seem to even disable the button.
So again, changing the cell with the date would enable the button, and the action of pressing the button itself would once again disable the button, is what I’m hoping.
FYI, LOGFORM, is the name of the form control command button.
Private Sub Worksheet Change(ByVal Target As Range)
If Target.Address= "$C$7" Then
Sheets("Sheet12").LOGFORM.Enabled = True
Else
Sheets("Sheet12").LOGFORM.Enabled = False
End If
End Sub
—————————————————————
Private Sub CommandButton1 Click()
End Sub