Home |
Search |
Today's Posts |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Add 30 days to Date | Mailmerge | |||
Excel Dates formatting in Word | Mailmerge | |||
The world is really unstable these days...... | Microsoft Word Help | |||
Tracking Changes - Entering dates of changes | Microsoft Word Help | |||
Dates | Microsoft Word Help |