Numberformat

B

Basta1980

HI,

Code below works fine. Now I would like to make a small adjustment. The
activecell.value needs to be changed from 612345678 to 00612-345678 without
actually changing the format in the cell.

Dim MyData As DataObject
Set MyData = New DataObject
MyData.Clear
MyData.SetText "0" & ActiveCell.Offset(0, 0).Value
MyData.PutInClipboard

Thankx in advance.

Basta
 
B

Basta1980

Hi Sam,

Thanx for helping. The actual numberformat is clear i.e. not the problem.
What I would like to do is just copy the value to clipboard in desired
numberformat without actually changing the value in Excel. Wit the code below
I get 0612345678, but the value in Excel remains 612345678.

Regards,

Basta
 
B

Basta1980

Hi Sam,

Thanx for helping. The actual numberformat is clear i.e. not the problem.
What I would like to do is just copy the value to clipboard in desired
numberformat without actually changing the value in Excel. Wit the code below
I get 0612345678, but the value in Excel remains 612345678.

Regards,

Basta
 
B

Basta1980

Hi Sam,

Thanx for helping. The actual numberformat is clear i.e. not the problem.
What I would like to do is just copy the value to clipboard in desired
numberformat without actually changing the value in Excel. Wit the code below
I get 0612345678, but the value in Excel remains 612345678.

Regards,

Basta
 
J

joel

Using Sam's suggestion, this is better

Dim MyData As DataObject

Set MyData = New DataObject
MyData.Clear
MyData.SetText = Format(ActiveCell.Value, "00000-000000")
MyData.PutInClipboar
 
B

Basta1980

Joel, Sam

Thanx for the input. Below suggestion works fine (just had to remove the =
because i got a variable error).

Thnx!!!
 

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

Top