Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
vba format question
cells(1).value = 3
With code I would like to convert this value into 03 for use elsewhere ie:show single digit numbers as 2 digit in a message box I've tried variations of the code below but no joy so far dim txt as string txt = format(cells(1).value, "00") msgbox txt |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
vba format question
This code seems to work for me with the sheet with A1 holding 3 in it
currently active: Dim myText As String myText = Format(ActiveSheet.Cells(1), "00") MsgBox myText "David" wrote: cells(1).value = 3 With code I would like to convert this value into 03 for use elsewhere ie:show single digit numbers as 2 digit in a message box I've tried variations of the code below but no joy so far dim txt as string txt = format(cells(1).value, "00") msgbox txt |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
vba format question
Thanks J
This is a weird one Original code worked ok on my home machine Today works OK on the original machine When I first posted the problem I was getting a single chr "3" in msgbox Tried & failed to reproduce the problem today by reformatting cells(1) Maybe a bug? Thanks anyway "JLatham" wrote: This code seems to work for me with the sheet with A1 holding 3 in it currently active: Dim myText As String myText = Format(ActiveSheet.Cells(1), "00") MsgBox myText "David" wrote: cells(1).value = 3 With code I would like to convert this value into 03 for use elsewhere ie:show single digit numbers as 2 digit in a message box I've tried variations of the code below but no joy so far dim txt as string txt = format(cells(1).value, "00") msgbox txt |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
.csv Re-Format Question | Excel Discussion (Misc queries) | |||
Format Question | Excel Discussion (Misc queries) | |||
Yet Another Name Format Question | Excel Discussion (Misc queries) | |||
Format Question | Excel Discussion (Misc queries) | |||
Format % Question | Excel Worksheet Functions |