• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

correct this code????

hi all,

please anyone can correct this code for me?

Code:
Sub test()
      
        With ActiveWorkbook.Worksheets("Sheet1").Range("A4")
            .FormulaR1C1 = "=" & "QTR: " & "LOOKUP(MONTH(Now()),{1,4,7,10},{""FOUR"",""ONE"",""TWO"",""THREE""})"
            .Font.Bold = True
            .Merge
            .Value = .Value
            .HorizontalAlignment = xlJustify
            .VerticalAlignment = xlCenter
        End With

End Sub
 
Taking a guess that you translating the current month into quarters:
Code:
Sub test()
     
    With ActiveWorkbook.Worksheets("Sheet1").Range("A4")
        .Font.Bold = True
        .Value = "QTR: " & Evaluate("LOOKUP(MONTH(TODAY()),{1,4,7,10},{""FOUR"",""ONE"",""TWO"",""THREE""})")
        .HorizontalAlignment = xlJustify
        .VerticalAlignment = xlCenter
    End With

End Sub
 
Hi ,

Correct one statement as follows :

Code:
.Formula = "=" & """QTR: """ & " & " & "LOOKUP(MONTH(Now()),{1,4,7,10},{""FOUR"",""ONE"",""TWO"",""THREE""})"
Narayan
 
Taking a guess that you translating the current month into quarters:
Code:
Sub test()
    
    With ActiveWorkbook.Worksheets("Sheet1").Range("A4")
        .Font.Bold = True
        .Value = "QTR: " & Evaluate("LOOKUP(MONTH(TODAY()),{1,4,7,10},{""FOUR"",""ONE"",""TWO"",""THREE""})")
        .HorizontalAlignment = xlJustify
        .VerticalAlignment = xlCenter
    End With

End Sub


thank's a lot for this correction
 
Back
Top