Replace "#" with an integer in VBA

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,

I'm trying to write some code that will read the value in a cell, and if a
"#" appears somewhere in the string, it will be replaced with either a 1 or a
2 (depending on user entry).

I've tried using the Application.WorksheetFunction.Replace function, but I
can't get the arguements to work.

Any help that anyone can provide would be greatly appreciated.

Thanks in advance and have a great one,

Mike
 
Hi Mike

try using the substitute function instead e.g.

ActiveCell.Value =
Application.WorksheetFunction.Substitute(ActiveCell.Value, "#", 1)

Cheers
JulieD
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top