Excel VBA: Extracting numbers as text, then pasting?

No replies
User offline. Last seen 3 years 30 weeks ago. Offline
Joined: 10/26/2008
Posts: 11

I have a cell that has "Task 012." To extract the "012" portion I am doing the following:

str_var = Right(ActiveCell.Value, 3)

When I display the result with a MsgBox it states "012" which is what I want.

However, when I apply str_var to another cell, the value becomes 12 instead of 012. How can I make it 012?

I think this has something to do with numbers being formatted as text.