Hi,

If I understand you correctly, the following line of code does what you ask, to 
the active cell.

 

If Weekday(Date) = 2 Then ActiveCell = Date - 3 Else: ActiveCell = Date - 1
 

Regards - Dave.

 

 



Date: Fri, 16 Apr 2010 10:36:13 +0530
Subject: $$Excel-Macros$$ Excel-Macros : Help
From: nsund...@gmail.com
To: excel-macros@googlegroups.com



Hi Friends,
 
Please complete this coding. Condition is if the current day is Monday then i 
need to have Privious Friday Date in the header else just previous day date. 
 Please help me to complete my project
 
 
 
 
    Range("A1:IV65536").Select
    With ActiveSheet.PageSetup
    End With
    ActiveSheet.PageSetup.PrintArea = ""
    With ActiveSheet.PageSetup
    
    Dim dt As Variant
    'Dim mnd As Integer
    'Dim D As String
    
    Worksheets("N022D").Range("A65536").Formula = 
"=TODAY()-CHOOSE(WEEKDAY(TODAY()),2,3,4,5,6,7,1)"
    Range("A65536").Select
    dt = ActiveCell.Value
    ActiveCell.Value = ""
 
    Dim D As Integer
    'Dim N As Date
    Dim N As Integer
    
    D = Weekday(Now)
    'N = Now() + (9 - D)
    N = 2
    If D = N Then
    e = dt
    Else
    e = c

    'Worksheets("N022D").Range("A65535").Formula = "=TEXT(TODAY(),"dddd")"
    'Worksheets("N022D").Range("A65535").Formula = "=Value(WEEKDAY(TODAY()))"
    'Range("A65535").Select
    'mnd = ActiveCell.Value
    'If mnd = "2" Then
    'D = dt
    'Else
    'D = c
    End If
    'ActiveCell.Value = ""
        e = Format(vbGeneralDate)
        c = FormatDateTime(Date - 1, vbGeneralDate)
        .CenterHeader = "APPROVAL REPORT (" + e + ")"
        .CenterFooter = ""
        .PrintGridlines = True
        .Orientation = xlLandscape


-- 
N.Sundarvelan


-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com

To post to this group, send email to excel-macros@googlegroups.com
 
<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!
 
We reach over 6,800 subscribers worldwide and receive many nice notes about the 
learning and support from the group.Let friends and co-workers know they can 
subscribe to group at http://groups.google.com/group/excel-macros/subscribe
                                          
_________________________________________________________________
New, Used, Demo, Dealer or Private? Find it at CarPoint.com.au
http://clk.atdmt.com/NMN/go/206222968/direct/01/

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!

We reach over 6,800 subscribers worldwide and receive many nice notes about the 
learning and support from the group.Let friends and co-workers know they can 
subscribe to group at http://groups.google.com/group/excel-macros/subscribe

Reply via email to