First Code In VBA: Use A Inputbox For Entering The First Date For Monday Of The Month Each Time I Use The Worksheet
Jun 23, 2006
I am writing a module which have a different test based on for each of the previous 2 column cells. It calculate the days passed or in simple way calculate the date difference for the 2 columns and puts them in third. But i need to use a inputbox for entering the first date for monday of the month each time i use the worksheet.
When i try using the module for each cell of the column it display the input box for each cell. is there any way so that i just enter the value in input box and it can be used in rest of the module.Without using it again and again.
View 8 Replies
ADVERTISEMENT
Apr 24, 2006
to determine the number of 1st Mondays or any weeday e.g. 5th Fridays between a date range e.g. 1/1/2006 - 4/1/2006.
I've noticed a lot of threads for calculating just one month but none for a period of time.
View 14 Replies
View Related
Feb 2, 2004
This formula on the forum has helped me to find the first day I specify of the month of a certain year. (here a monday in august of the year specified in B1)
=DATE(B1;8;8-WEEKDAY(DATE(B1;8;1);3)-IF(WEEKDAY(DATE(B1;8;1);3)=0;7;0))
As I'm not really good at understanding the formula (I get confused with the =0;7;0 bit), even though I can make it work I'd like to know how I can find the a last specific day (mo-su) in a month.
View 9 Replies
View Related
Sep 23, 2007
I am currently using this formula =DATE(YEAR(A1),MONTH(A1)+6,DAY(A1)) to get me 6 months ahead from a certain date. There is a new problem that has arose for me. I need a formula that will give me 6 months from a certain date if it falls on a Monday if the 6 months does not fall on a Monday then give me the next Monday date.
for example 6 months from 1/2/2007 is 7/2/2007 which falls on a Monday which is fine but, If the start date was 1/3/2007 this falls on a Tuesday so I would need the next Monday date 7/9/2007.
View 9 Replies
View Related
Feb 4, 2014
I’m working on a project using Microsoft Excel 2010 and I want to add some features to facilitate saving and retrieving files process.
1.How can I save the daily created workbooks (Assume 15 files a day) in order to contain the current date (and time if possible) linked with certain cell(s) I have at my workbook forming the file name? (XYZ 2-4-2014) and/or (ABC 2-4-2014 23:11) and so on …
2.I’ve been through some other posts and I found VB code which saves the active file into specific path, but it is only useful for single workbook because multiple files are getting overwritten automatically. Is there a code which allows multiple/different files saving & creates daily folders?
View 4 Replies
View Related
Jun 26, 2013
In the workbook the sheet names are month names e.g. july,august,September etc and 1st of each month is to be entered in a cell in each the sheets. By some trial and error I wrote this macro
VB:
Sub test()
Dim j As Integer, monthnr As Long, monthname As String
For j = 1 To Worksheets.Count
[Code]....
This worked in July sheet it is written as 7/1/2013 and in august sheet it is 8/1/2013 etc Then I shortened the macro like thlis
VB:
Sub test()
Dim dte As Date
dte = "july" & "/1/2013"
Range("A1") = dte
End Sub
It worked. Even if I use shortened 3 letter form of month like "Jul" or "aug" then also it works
But if type on the spreadsheet itself
="july"/1/2013
It Gives value error.
Perhaps it works only in vba and not spreadsheet.
I accept nobody is going to use "july" & "/1/2013" instead of 7/1/2013 But this will be useful if sheet names are month names so that when we write the date we can use sheet names Mine excel 2007 and windows 7.
View 2 Replies
View Related
Jul 26, 2013
I am entering data for ships arrived every month. There are about 200 records to be entered and for every record there are 4 date fields.
My question is : Is it possible to set default month (for ex = July) and year ( for ex = 2013 ) in these 4 cells so that
If I just type 16 it should be 16/07/2013. Because all my dates will be within that month July 2013.
View 2 Replies
View Related
Sep 2, 2006
Is it possible to get a inputbox to validate an entry as time in the format of HH:MM
ie: user must enter a valid time in the above format before the macro will proceed to the next line of code
View 7 Replies
View Related
Jul 11, 2012
I have to complete information providing dates and names for a long number of individuals. Is it possible to set up the spreadsheet so that if you enter a date next a persons details in on worksheet their information is automatically updated in the relevant ones?
View 2 Replies
View Related
Jun 1, 2007
I was wanting to input the date Before Printing. I want to write some code.
Private Sub Workbook Before_Print (cancel as booleen)
Inputbox = "Enter the date you would like in Mondays cell C4"
Application.Worksheet.Range("C4").Value = InputBox.Value
PrintDialogBox.Show
End Sub
I know I am making a very rough attempt at what I am trying to achieve, I just don't know coding that well.
View 9 Replies
View Related
Mar 31, 2007
I am trying to create/modify an XY scatterplot using VBA.
I declare local variables and point them to the chart and a new data series for the chart, such as:
Dim chartone As Chart
Dim chartseries As Series
Set chartone = ThisWorkbook.Charts("Chart1")
chartone.ChartType = xlXYScatterLines
Set chartseries = chartone.SeriesCollection.NewSeries()
I set the series data, using an array, such as:
chartseries.Values = Array(1, 3, 5, 7, 9, 11)
I can set the Xvalues to a set of dates by setting .Xvalues to a woksheet range that includes date-formatted data. (like this):
chartseries.XValues = Worksheets("sheet3").Range("m9:m14")
(where m9:m14) contains dates...
View 4 Replies
View Related
Dec 25, 2006
I am currently looking for a formula that will give me the actual date for the first Monday of the week.
I have for example in column A dates from 1st Jan 06 to 31st Jan 06 I just need to workout what the date is for the first Monday then after that for the 2nd Monday it would just be the 1st Monday +7.
View 9 Replies
View Related
Apr 9, 2014
I need a macro that allows a user to input a Month and a Year on an input box. When this is done the macro would pull out the date for each Monday (in the format DD-MM-YY) in that month and paste it into four or five cells (A1:A5)
Eg for April 2014
A1
A2
A3
A4
A5
07-04-14
14-04-14
21-04-14
28-04-14
View 2 Replies
View Related
Dec 1, 2012
In a sheet I enter the following:
... in A1 a year (say 2012)
... in A2 a month, formatting as "MMM" (JAN, FEB, MAR etc.)
How to automatically get in column A (say from A3) all the dates of the month entered, formatting as "D/M/YYYY" (e.g. 1/1/2012, 2/1/2012/ 3/1/2012, etc.)?
View 3 Replies
View Related
Jan 17, 2008
In cell A1 I have a date (like 8/1/08)
In A3, B3, and C3 I need to have the first Monday, Thursday, and Friday of the month. Here's the caveat, I need A3 to have the day that comes earliest in the month.
In this case, A3 would contain 8/1/08 since it's the first Friday, B3 would have 8/4/08 as the first Monday, then C3 would have 8/7/08 as the first Thrusday.
If A1 contained 7/1/08 then A3 would have 7/3/07 as the first Thursday with Friday and Monday following.
View 9 Replies
View Related
Jun 17, 2006
I am attempting to pick up a date with time entry on a worksheet and place it into a TextBox on a UserForm. Format on the sheet is mm/dd/yyyy h:mm AM/PM. The UserForm is placing the value as mm/dd/yyyy 12:00 AM. here is the
Private Sub UserForm_Initialize()
If Not Range("dDate").Value = "" Then
TextBox2.Value = Range("dDate").Value
TextBox2.Text = Format(DateValue(TextBox2.Text), "mm/dd/yy h:mm AM/PM")
Else
TextBox2.Value = ""
TextBox2.SetFocus
End If
End Sub
"dDate" is the named range where the date is sitting. The format is also set on the TextBox2 exit event. Can anyone see why only the date portion is being transfered with the default 12:00 AM for no time component of the value?
View 3 Replies
View Related
Dec 19, 2008
I have a worksheet which contains START TIME in column A, then TIME USAGE in column B and END TIME in column C. User enters start time, followed by the number of time usage in minutes, how could i possibly display the end time automatically in this scenario? how do you add the entered time usage to the start time to display the end time? Say if I enter 1:00 AM at start time and 00:15 minutes on time usage, how can 1:15 AM be displayed on the end time automatically?
View 2 Replies
View Related
Apr 21, 2013
How do i calculate the time between 22:00hrs and 08:00hrs without entering a date? Is this possible or do i need to enter a date?
View 9 Replies
View Related
Aug 24, 2014
I have a list of dates and I need a formula that will return the date of the following Monday, IF the date falls on a Friday, Saturday or Sunday.
View 3 Replies
View Related
Aug 13, 2009
Need a way to get/calculate ALL of the days of the months from a date range entered into an inputbox in which a user may enter any day of a month? In other words, the user enters 9/14/2009 in the first inputbox then 10/8/2012 in the second and code would calculate the number of days as 9/1/2009 - 10/31/2012.
Here is the current code I'm using that calculates only the exact days:
View 3 Replies
View Related
Apr 16, 2014
I have a formula
=AL260-WEEKDAY(AL260,2)+MATCH(AP260,{"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"},0)
The formula looks at the chosen start date (AL260), and then uses a displayed text day (AP20) to display the relvent date to the text day, this works fine however if the start date is say 08/08/14 (a Friday) when the formula detects a Monday (this copies down a range looking at the start date and the text days to produce dates on each line, the formula displays the Monday dates prior to start date, is there any way to alter this to make it display the dates ahead of the chosen start date?
View 10 Replies
View Related
Oct 3, 2012
In cell E1, I have the month displayed. In cell I50, when I add the date of say the 5th, I want it to add the month to it so it will read, 10/5 or 5-Oct. This will be true for cells I50:I164
View 8 Replies
View Related
May 20, 2013
Macro to highlight a cell A1 every monday ( or any day) when we open the book for the first time.
Macro should not run when we open the book from the next time till that week gets over and again it should run once the next week started.
View 1 Replies
View Related
Feb 29, 2008
Suppose the current month is Feb-08. How will I be able to get the next and the next months in this format(i.e Mar-08 and Apr-08). I am able to get Feb-08 but unable to get the following months. i did lots of google search but was unable to find any examples..
View 2 Replies
View Related
Jul 29, 2008
The clue's in the title. I have a date in cell (BC25). I need to jump forward by one year then if the date doesn't fall on a Monday I need to find the next Monday.
I've looked at this thread which should point the way but I'm particularly dim this morning and can't get it to work.
http://www.mrexcel.com/forum/showthr...ghlight=monday
View 9 Replies
View Related
May 4, 2009
I need a VBA code which tells me the date of previous monday of any date. The user types in any date to the cell A1, and I need the date of previous monday to be inserted to the cell A2.
For example:
A1: 9/5/2009 --> A2: 4/5/2009
A1: 19/5/2009 --> A2: 18/5/2009
A1: 27/12/2009 --> A2: 21/12/2009
View 4 Replies
View Related
May 8, 2014
How to write a VBA code so that it would calculate the date of the previous Friday and from there Return the date exactly 1 month before; on any given day.
For example...
today is may 8th
So if I run the code the dates returned for last friday should be 05/02/2014
and 04/04/2014 should be returned AS the DATE exactly a month from 05/02/2014
View 6 Replies
View Related
Jan 16, 2007
Is it possible to to return a date that begins on following mondayand adds days unless it was entered on a monday then just add 17 days
if someone enters a date say 10/01/07 (wednesday) i need to be able get the following mondays date and add 10 days to it IE 25/01/07
View 14 Replies
View Related
Sep 20, 2006
I want to be able to test if a date entered in a cell (Format dd/mm/yyyy) equals a "Monday". If it doesn't, I want to display a warning message.
View 6 Replies
View Related
Feb 6, 2008
I have two workbooks, one a database that accumulates data over time, and the other a monthly report that needs to be populated based on information from the database. When moving data between the two, the following works fine (snipped a lot for ease of reading):
Workbooks.Open (database) ', Password:= /
Workbooks(reportbook). Sheets("Sheet1"). Range("A1").Value = month(Cells(282, 5))
As you can see, it simply puts the month from a cell in the database into the report workbook. However, if I change Range("A1") to Cells(1,1) I get a runtime error:
Workbooks.Open (database) ', Password:= /
Workbooks(reportbook).Sheets("Sheet1").Cells(1, 1).Value = month(Cells(282, 5))
I can generally work around this issue by changing the active workbook, but doing so is a big pain. Is there any way to use the second bit of code without popping an error message?
View 3 Replies
View Related