formatting ques...

M

mike

I want Excel to store an actual time (like "8:00") taken
from a cell in my worksheet rather than the decimal
equivalent (like .025) excel uses to represent time. Is
there a function to convert this? currently I have
declared the variable as a string.

Also, I cannot get excel to format my user defined data
type so it has a number format of "ddd" (which is the name
of the day, like mon, tue, etc..) My code is as follows:

Dim DateCell As Range
Set DateCell = Worksheets(1).Cells(row, 5)
DateCell.NumberFormat = "ddd"
Switching(i).DayofWeek = DateCell

where switching is my user defined data type and DayofWeek
is declared as a string. the data in Worksheets(1).Cells
(row,5) is a date and formatted like "11/15/2003"

thanks
 
T

Tom Ogilvy

Dim DateCell As Range
Set DateCell = Worksheets(1).Cells(row, 5)
DateCell.NumberFormat = "ddd"
Switching(i).DayofWeek = DateCell.Text
or
Switching(i).DayofWeek = format(DateCell.Value2,"ddd")


Dim sTime as String
sTime = Format(now(),"hh:mm")
 

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