Reply
 
Thread Tools Display Modes
  #1   Report Post  
Jim
 
Posts: n/a
Default Forumla for converting dates into days

I have a table in a works document. In columnn 1, I have topics, in column 2
is the date (ie August 12, 2005), column 3, is to show the day of the week
(ie Monday)

PLease help!!!!!
  #2   Report Post  
Doug Robbins
 
Posts: n/a
Default

I don't think that Works has this capability, but with Word, the format
function can be used:

MsgBox Format(#8/12/2005#, "DDDD") returns Friday

So when you have the selection in the table, you could use a macro
containing the following code, (assuming that the first row of the table is
a heading row;

Dim mytable As Table, dtrange As Range, i As Long, strDate As Date

Set mytable = Selection.Tables(1)
With mytable
For i = 2 To .Rows.Count
Set dtrange = .Cell(i, 2).Range
dtrange.End = dtrange.End - 1
strDate = dtrange
.Cell(i, 3).Range = Format(strDate, "DDDD")
Next i
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
"Jim" wrote in message
...
I have a table in a works document. In columnn 1, I have topics, in column
2
is the date (ie August 12, 2005), column 3, is to show the day of the
week
(ie Monday)

PLease help!!!!!



  #3   Report Post  
macropod
 
Posts: n/a
Default

Hi Jim,

Simply bookmark the date (not the cell!) in column B, then use a ref field
in Column C to extract the date. For example:
If the date in B1 is August 12, 2005, and you bookmark this as 'B1Date',
then you'd use a REF field in C1 coded as:
{REF B1Date \@ dddd}. This should return 'Friday', not 'Monday' as indicated
in your post ...

Cheers
PS: The field braces (i.e. '{}') are created in pairs via Ctrl-F9.
Alternatively, you can create the REF field via Insert|Field.


"Jim" wrote in message
...
I have a table in a works document. In columnn 1, I have topics, in

column 2
is the date (ie August 12, 2005), column 3, is to show the day of the

week
(ie Monday)

PLease help!!!!!



  #4   Report Post  
trinity
 
Posts: n/a
Default Forumla for converting dates into days


Is there a way to get this added to a new row automatically when the new
row is created (eg by pressing tab at the end of the last row)?

macropod Wrote:
Hi Jim,

Simply bookmark the date (not the cell!) in column B, then use a ref
field
in Column C to extract the date. For example:
If the date in B1 is August 12, 2005, and you bookmark this as
'B1Date',
then you'd use a REF field in C1 coded as:
{REF B1Date \@ dddd}. This should return 'Friday', not 'Monday' as
indicated
in your post ...

Cheers
PS: The field braces (i.e. '{}') are created in pairs via Ctrl-F9.
Alternatively, you can create the REF field via Insert|Field.


"Jim" wrote in message
...
I have a table in a works document. In columnn 1, I have topics, in
column 2
is the date (ie August 12, 2005), column 3, is to show the day of
the
week
(ie Monday)

PLease help!!!!!



--
trinity
  #5   Report Post  
Doug Robbins - Word MVP
 
Posts: n/a
Default Forumla for converting dates into days

If you were using formfields as in a protected document, you could use a
modification of the following:

Sub addrow()

'

' Macro created 02/02/03 by Doug Robbins

' To add a new row to a table containing formfields in every column

' automatically on exit from the last cell in the present last row of the
table

Dim rownum As Integer, i As Integer

ActiveDocument.Unprotect

ActiveDocument.Tables(1).Rows.Add

rownum = ActiveDocument.Tables(1).Rows.Count

For i = 1 To ActiveDocument.Tables(1).Columns.Count

ActiveDocument.FormFields.Add
Range:=ActiveDocument.Tables(1).Cell(rownum, i).Range,
Type:=wdFieldFormTextInput

Next i

ActiveDocument.Tables(1).Cell(ActiveDocument.Table s(1).Rows.Count,
ActiveDocument.Tables(1).Columns.Count).Range.Form Fields(1).ExitMacro =
"addrow"

ActiveDocument.Tables(1).Cell(ActiveDocument.Table s(1).Rows.Count,
1).Range.FormFields(1).Select

ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True



End Sub

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"trinity" wrote in message
...

Is there a way to get this added to a new row automatically when the new
row is created (eg by pressing tab at the end of the last row)?

macropod Wrote:
Hi Jim,

Simply bookmark the date (not the cell!) in column B, then use a ref
field
in Column C to extract the date. For example:
If the date in B1 is August 12, 2005, and you bookmark this as
'B1Date',
then you'd use a REF field in C1 coded as:
{REF B1Date \@ dddd}. This should return 'Friday', not 'Monday' as
indicated
in your post ...

Cheers
PS: The field braces (i.e. '{}') are created in pairs via Ctrl-F9.
Alternatively, you can create the REF field via Insert|Field.


"Jim" wrote in message
...
I have a table in a works document. In columnn 1, I have topics, in
column 2
is the date (ie August 12, 2005), column 3, is to show the day of
the
week
(ie Monday)

PLease help!!!!!



--
trinity



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Add 30 days to Date JDP@Work Mailmerge 5 June 10th 05 10:49 PM
Excel Dates formatting in Word Paul - NottsUK Mailmerge 1 May 22nd 05 08:02 AM
The world is really unstable these days...... [email protected] Microsoft Word Help 0 May 16th 05 04:29 AM
Tracking Changes - Entering dates of changes Lisa Glase Microsoft Word Help 1 March 3rd 05 10:14 AM
Dates Walt G Microsoft Word Help 3 January 16th 05 10:28 PM


All times are GMT +1. The time now is 01:31 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"