If the active cell is a2 and i dont want my "Previous" Button to be enabled because the previous cell is the column header (a1).. how do i code the prevbutton.enabled=false
If the active cell is a2 and i dont want my "Previous" Button to be enabled because the previous cell is the column header (a1).. how do i code the prevbutton.enabled=false
add
Please Login or Register to view this content.
if cell value meets your criteria the button will work, otherwise nothing will happen
i like this one tbh
that way a message box comes up if the button is pressed when you don't want it to be.Please Login or Register to view this content.
You did not provide any information on the type of button so I have assumed ActiveX
Use the Sheets selection_Change event
You will probably need to expand on this in your actual file, as it works only when A2 is entered.Please Login or Register to view this content.
Doesn't seem to work.. and it is a button that comes default from the toolbox.
The toolbox has 2 button types.
Post example file
Welcome to the forum
Please attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.
Remember to desensitize the data.
Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
On the Routing Chart Sheet there is a button to open the form.
My goal is when you click the "previous entry" button that it will no longer
reach cell A1. It will stop at A2.
You did not mention this was a userform.
Modify the open form button code to load first record on open
Add this code to end of the prevbutton_Click event routine.Please Login or Register to view this content.
Please Login or Register to view this content.
@Andy Pope , is it possible do that not ActiveX just normal button?
I try mod the code but it gives error
HTML Code:
You do not need that sheet event code.
As I said you did not mention at the start that this was a userform. I assumed the Next/Previous buttons where on the worksheet.
All the navigation buttons are on a userform so you just need the code provided for userform button events.
just curiosity without use userform
You can not disable a Forms control.
You would need to check row in the assigned macro and then process the code or exit the sub.
so if I decide writing in specific value in cell B2 like "OK" then should enable the button and run the macro and if the cell B2 is empty should disable the button and doesn't run the macro
is it possible ?
You can not disable the button. Your code would be something like this
Please Login or Register to view this content.
thanks for your time
works great! only problem is now the first input box no longer gets focus upon opening the userform.
[edit] i was using the .enabled which was not allowing the text box to gain focus. I instead found the .locked and now it is working as intended.. thank you very much for your help. it is very much appreciated.
Last edited by bashscript; 05-19-2021 at 10:26 AM. Reason: fixed it
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks