excel - VBA to clean characters from CELL -


vba clean characters cell, script meant through worksheets in open work book , remove special characters (so can rename tab cell) cleaning page script run.

sub cleanchar() dim ws worksheet dim mystring string dim newstring string  each ws in worksheets     ws         mystring = range("a1").value         newstring = replace(replace(mystring, ":", ""), """", "")         range("a1").offset().value = newstring     end next ws  end sub 

i think issue might lacking . in front of range objects. state with ws don't use ws, range object referring 1 worksheet.

try modified code:

sub cleanchar()      dim ws worksheet     dim mystring string     dim newstring string      each ws in worksheets         ws             mystring = .range("a1").value             newstring = replace(replace(mystring, ":", ""), """", "")             .range("a1").offset().value = newstring         end     next ws  end sub 

Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -