PDA

View Full Version : [SOLVED:] Ratio being force formatted into Time



llldebaserll
04-11-2014, 10:29 AM
Hi Folks,

I'm having a really odd issue that I'm sure has a simple solution. I just can't find it.

I'm trying to add a ratio value to a cell but every time I do so, it automatically converts it to a time.
I've tried a few different things, like formatting the cell before I add the data. Or even adding untime related data to the value and then removing it after it's places. It still reformats the data.

Unadulterated, this is what the code I'm using to take the data from a userform and enter it onto the Worksheet.


Range("L11").Value = AddForm.IRDensityBox.Value



I can't share the actual workbook but I've attached a copy of the problem column.
Formatting Issue Sample.xlsx (http://www.vbaexpress.com/forum/attachment.php?attachmentid=11555&d=1397236754)
As you can see, there are already a bunch of values of "1:6" that were entered in the past. But if you even select the cell, place the cursor into the formula bar and hit enter, BAM it reformats.

My simple task is to automate this process but this formatting thing is killing me.

Any help would be greatly appreciated.

Bob Phillips
04-11-2014, 11:26 AM
Try


Range("L11").Value = "'" & AddForm.IRDensityBox.Value

llldebaserll
04-14-2014, 08:09 AM
Thanks xld!

That worked perfectly! I'm glad I copy and pasted the code because I almost didn't notice the ' within the " ".