exact sequence in certain cells?

AwesomeSteph

Board Regular
Joined
Aug 18, 2017
Messages
80
I am looking for a VBA to only allow an exact sequence for instance if cells in column A aren't typed in containing "A-12-34-5678-01AAA-123A-B" with same number of numbers between dashes then they get an error and it is deleted. Any suggestions?
 
That error would indicate that the variable type does not match the value being assigned to it, though as I mentioned, it is working fine as I copied it straight from your post. I don't know what else to try. Further confused because it's highlighting the .ClearContents line.
 
Upvote 0

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
I'm so sorry! I found my mistake and it was because of a merged cell that I had forgotten about. I apologize again thank you for your help!
 
Upvote 0
Now I have another problem though, the code for B8 is working fine but now the other code to show the other sheets when certain cells are filled in isn't working or the commandbutton :(
 
Upvote 0
By not working, are you getting errors or is it just not doing anything that you can see?
 
Upvote 0
No errors, just nothing. Usually when all the field are filled in the other hidden sheets appear and so does the button but now it just doesn't do anything no tabs no button.
 
Upvote 0
Ok, you said this code was working elsewhere correct? Interesting, I've not seen references to range like this before: [B4]. I replaced those with Range(" ") and the code seems to be working just fine. Also, you can remove the second IF statement and just move the lines to show/hide the command button into the first IF statement since it's testing the exact same thing.
 
Upvote 0
Perhaps you need to re-enable events. This can happen if the code gets past the line to disable events, but then encounters an error or stops before reaching the line to enable events again. Essentially rendering your code useless because the event to trigger it is not even being registered.

Try this and let me know what happens:

Code:
Sub EnableEventsAgain()
Application.EnableEvents = True
End Sub

You'll have to run this sub manually with the ">" (green play button) in the VB editor.

Edit: Glad it's working now.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

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