![]() |
Excel: Prohibit special character entry into a cell I have a cell that will be used for a filename when the user closes Excel. I need to either: 1. Prohibit special characters from being entered into the cell. -Or- 2. Only allow all other characters besides the special characters to be entered into the cell by the user. Can anyone help?? This is driving me crazy!!!!! THANKYOU!! :confused: |
Replace special characters with "" Another option would be to replace special characters with something else. I have a macro that the users execute by clicking a graphic that changes the filename to the cell in question after they fill out the form. If I could put some code in there that detected special characters and replaced them with something else, that would work too. Appreciate any help!!! |
I don't know if you can do this with excel, but couldn't you do this within your macro before saving? Prompt the user if the filename is invalid, or simply replace the unacceptable characters. |
Replace invalid filename characters Thanks for your reply William, Either would be acceptable, I'm just not sure how to do it... (I'm not a very good programmer - I'm actually just an electrician who got roped into making this spreadsheet because I worked with computers in one of my past lives)... Here's the macro I have so far. This is executed after the user fills out a form and clicks on a graphic: Sub SaveFile() Dim FName As String Dim FPath As String FPath = "C:\SCI_REPORTS" FName = Sheets("SCI REPORT").Range("D3").Text ThisWorkbook.SaveAs Filename:=FPath & "\" & FName Call Shell("C:\SCI_REPORTS\UTILITIES\SCI_XFR_621.bat", vbNormalFocus) Call Shell("C:\SCI_REPORTS\UTILITIES\ExcelExit.bat", vbNormalFocus) End Sub If I could tweak this to prompt the user or just replace the invalid characters (preferrably just replace the invalids). I'd be home free! Thanks again! -John |
All times are GMT -4. The time now is 07:15 PM. |
Copyright © 2005-2013 SysChat.com