SysChat

SysChat (http://www.syschat.com/forum.php)
-   General Software (http://www.syschat.com/software-support/general-software/)
-   -   Excel: Prohibit special character entry into a cell (http://www.syschat.com/excel-prohibit-special-character-entry-into-4613.html)

jowilla442 05-19-2009 03:53 PM

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:

jowilla442 05-20-2009 02:25 PM

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!!!

William_Wilson 05-20-2009 02:59 PM

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.

jowilla442 05-20-2009 03:39 PM

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 04:33 AM.


Copyright © 2005-2013 SysChat.com


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54