Hi All,
Can you please help me to create a macro?
I want to add the Last business date in B3 cell just by running a macro.
Thanks in advance
Nikhil
Hi All,
Can you please help me to create a macro?
I want to add the Last business date in B3 cell just by running a macro.
Thanks in advance
Nikhil
What is the definition of 'Last Business Date' ?
let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source
If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE
Walking the tightrope between genius and eejit...
Hi Olly,
I mean, for Monday, that last business day was Friday & for Friday its Thursday.
Thanks
This is Great!!Thanks Olly, Below is the code which i have made with the help of recording tool as well the date macro you gave. However this gives me an error as "Cant execute the code in break mode"
Sub Macro3()
'
' Macro3 Macro
'Range("B4").Select
Sheets("Unwind & Reset").Select
Rows("1:1").Select
ActiveSheet.ShowAllData
Sheets("Cash Activity Report").Select
Selection.ClearContents
Sheets("DATA").Select
Cells.Select
Selection.ClearContents
Range("E26").Select
Sheets("Cash Activity Report").Select
Range("A1").Select
Select Case Weekday(Date, vbMonday)
Case 1: Range("B3").Value = Date - 3
Case Else: Range("B3").Value = Date - 1
End Select
End Sub
I am gettiing the error when it reaches Here " ActiveSheet.ShowAllData"
Please help me out to fix this
Thanks
- Wrap CODE tags around your code when you post.
- To exit break mode, click the 'reset' button (blue square) on the toolbar in the visual basic editor.
- There's a lot of unnecessary selecting going on there... Are you trying to clear the contents of ALL cells in worksheets [Cash Activity Report] and [DATA], or only certain ranges (and if only certain ranges, what are those range addresses?)
Here's a rewrite of your code without all that unnecessary selecting - but beware, this will clear the contents of ALL cells in those two worksheets... If this isn't what you want, you need to specify the actual range to be cleared.
Sub Macro3() Sheets("Unwind & Reset").ShowAllData Sheets("DATA").Cells.ClearContents With Sheets("Cash Activity Report") .Cells.ClearContents Select Case Weekday(Date, vbMonday) Case 1: Range("B3").Value = Date - 3 Case Else: Range("B3").Value = Date - 1 End Select End With End Sub
Hi Olly,
I want this date format as mm-dd-yyyy for this;
Sub foo()
Select Case Weekday(Date, vbMonday)
Case 1: Range("B3").Value = Date - 3
Case Else: Range("B3").Value = Date - 1
End Select
End Sub
Can you please help me with this. At present this is giving me dd-mm-yyyy
Last edited by Nikhil V V; 01-30-2014 at 06:07 PM.
Change the numberformat of cell B3.
And again, wrap CODE tags around code you post...
Does this help?
http://books.google.be/books?id=46to...=JKjqUpjwNMPNs
Sub DateText() Range("B3").Value = Format(Date, "dd mmm YYYY") End Sub
Hi Gerard,
Thanks. But this gives me the current date. I want it like this: for Monday, Last business date is Friday. Likewise for Friday it is Thursday.
Please help me with this.
Thanks
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks