Add A New Comment With The Date/time Added To The Username
Oct 22, 2009
I need a mar that I want to attach to a button that would:Add a new comment with the date/time added to the username [format XYZ 22/10/09 14:48] and then I type the comment text, and/or
Append a new comment to the existing comment, in the same format as for 1.
i have the following code to insert comments into cells, however if the user cancels the input box (i.e. doesn't insert any text), a comment is still added with their details and the comment 'FALSE'. Is there anyway to stop comments being added if the user cancels the input?
Sub Insert_Comment() Dim iReply As Integer
Dim cl As Range Dim sComment As String Dim sText As String Dim UserNameWindows As String
I am looking to have a macro which will automatically add the username and date to a cell, when the cell above changes (or in this case =x). I have a bit of code from a previous project, but I have changed Target.Row to Target.Column and it is not behaving as I require:
Private Sub Worksheet_Change(ByVal Target As Range) If Not Intersect(Range("B2:BZ2"), Target) Is Nothing Then Range("C" & Target.Column).Value = Format(Date, "dd-mmm") & " " & Format(Time, "hh:mm") & " by " & (Application.UserName) End If End Sub
See the attachment for the example. What I need is whenever row 3 ="x" I need the corresponding cell in row "d" to update with the latest date, time and username. Please not the macro is currently not active on the sheet as i've added the ' character.
I am looking for a function to convert time given by my computer (Local time) in EST (Eastern Standard Time). We are several users of a same file (with timestamp macros) and all time need to be aligned to one time zone (EST), even if all users are working in different time zone (EST, CST and IST).
This time stamp macro is great but I would also like to record the person who said 'Y' in the same cell as the date stamp '12:00p.m. MWatson'. The persons name should come from the Username.
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Cells.Count > 1 Then Exit Sub If Not Intersect(Target, Range([P13], Cells(Rows.Count, "p"))) Is Nothing Then 'change your range on this line" With ActiveSheet If Target.Value = "Y" Then Target.Offset(0, 1).Value = Now
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?
I want to create a macro that when executed changes the name of "File1" to "File1 - Edited 8-9-2012". With the date being today's date (variable). This file is going to be emailed to someone who will then execute this macro.
Is there a way to prompt the Save As window with the updated file name so the user can save the file where ever he/she wants?
In one cell the user has to fill in a date, example 20.3.2008 and then in another cell he/she has to choose a month from a list (january-december). I need a macro that checks that the month stated in the date cell is the same as the month selected in the other list cell.
I have a formula in my spreadsheet that shows dates for servicing of products. Column F show's Date Last Serviced and the adjacent column (G) then shows Date Next Service. When there is nothing on the F column's cell then the date that appears on my spreadsheet is 31/12/00. It looks messy and I would rather have a formula to make it so that if the F column is blank, then the adjacent cell in G column should stay blank also.
To automatically calculate the next service due date, I have variants of this formula that creates the dates in G column:
how to copy the contents of multiple comment boxes and paste in a single comment box.
The big picture is that I have a number of cells with numerical values in and text in comment boxes. I want to be able to click a button to copy the contents of the comment boxes and paste them, along with the numerical value from the cell, into a single comment box, ordered by highest to lowest value within the comment box, then delete the original cells and comments.
I am quite new to VBA but have been coping quite well so far with information of the web and analysing recorded macros.
Cell B4 is selected by user and then runs the macro. The macro then looks UP (A3, A2, A1 etc) cell by cell until it finds the first cell that has a valid date in it and if that date is same as the date that the macro is being run pastes "This Text" into the comments section (Not replacing everything in the comments but simply adding to it.)
2/20/2009 (empty cell) Dave Jonathan Steve
2/21/2009 James Sally Tyler (empty cell) John Betty
My goal on the form is simply that when you click the check-box, it will highlight the cell green and place the date in the cell comment, and then clear the comment and color when unchecked.
I have been successful with the exception that I can only place text in the comment, but not a date stamp or even a reference to a hidden cell. I accomplished a date stamp command on a button with "Sheets("Sheet1").Range("Q5").Value = Date" but am unable to do this in a comment.
Below is what I have currently. I know it is not clean to look at, but that is how I found it and didn't want to create more variables for troubleshooting
Private Sub CheckBox1_Change() Sheets("Sheet1").Range("Q4").ClearComments Sheets("Sheet1").Range("Q4").Interior.Color = RGB(255, 255, 255)
I came across a couple results that seemed promising, but the code seemed to have a different syntax and I couldn't make it work with my VBA newbie skill level (started yesterday).
I have loaded a .csv file in which the first column contains date/times, e.g. 01/12/2012 00:00. How do I now tell Excel (2010) that this is in fact a date/time format? If I select one or more of the cells, click on the Number dialog box launcher and try to pick a suitable format tghe cells resolutely refuse to budge from being text (i.e. left-justified, still allows me to edit the 'seconds' component to a number > 60). Also which data type should I be using? The only one that appears to have a full date/time format listed is Custom (not Date or Time).
I import data from a program that exports dates and times as text. I have been successful using "text to columns" to separate the time from the date and then using =text(A1,"00:00")+0 to get the time to show as serial time but I'd love to be able to do the whole date/time string in one step. In cell A1 there is data that is general format and is in this format:
No matter how you try to format it, it is not a date or time. For this project I need the serial number for the date/time. Any formula that will format it as date/time and then allow it to show as a serial date/time?
I am using Excel 2013. Anyway, the first issue is that I need to pull a date and a time period from text. So, for example, if I see something like Sunday Prime Time 7/6/14 8:37PM, I would want to pull ONLY the "7/6/14 8:37PM" out of it. Each text box could potentially be different, so it might not always be in the same format as "Sunday Prime Time 7/6/14 8:37PM" it might only show just the date and/or the time without all the extra text i.e. 7/6/14 8:37PM. Some of the cells will have text, others might only have just the time or even just the date and the time. The only thing that I am worrying about in each cell is extracting just the date and time. If this is too much to ask of excel, I would be ok with extracting ONLY the time - 8:37PM and not the date, but I would much rather be able to get both the time and date.
THEN, onto part two of my question. After I would pull the dates and times, I need to compare them with each other. So, when I have the same date with two separate times on that date, I need to write a formula to show if those times on that date are less than 30 minutes apart. So, if I have 6 times on 7/6/14, I need to know if any of them are less than 30 minutes apart.
I would need to have the formula say something like "Problem" if the times on 7/6/14 would be 5:30PM, 5:48PM, 7:00PM, 8:00PM, 8:15PM, and 9:00Pm for example. I would like to see the word "Problem" since 5:30PM and 5:48Pm is only 18 minutes apart, and "Problem" after 8:15PM since that is only 15 minutes past the 8:00PM which is obviously under 30 minutes. The times that are more than 30 minutes apart such as 7:00PM and 9:00PM for example are more than 30 minutes apart from any of the other times that were extracted.
I have a sheet with a list of dates in it that I wish to format to show the day as well as date and time. I am trying to do this automatically with a macro, below is the before and the desired after.
Before Format - dd/mm/yyyy hh:mm Appearance - 29/03/2009 00:30
After Format - ddd dd/mm/yyyy hh:mm Appearance - Sun 29/03/2009 00:30
This works fine when I format the cells manually, but when I try to format them via macro '29/03/2009 00:30' becomes 'Sun 29/03/2009 12:30' which is obviously a totally different time! Has anyone got ay idea why it might be doing this?
'light eligibility Dim facb As String Dim sunset As Variant [color=green]' check if facility has lights[color] facb = WorksheetFunction.VLookup(RID, ds, 10, False) 'find facility code If WorksheetFunction.VLookup(facb, fac, 6, False) = "Y" Then 'facility has lights sunset = WorksheetFunction.VLookup(tempws.Range("A9"), sun, 2, False) 'lookup the sunset time based on the record's date
This code checks the need for lights at a facility.
It first checks to see if the facility even has lights by cross-referencing a value in the record with a facilities database.
If it has lights, it then checks to see if they are needed. If the rental goes past the sunset time, then it needs lights. Sunset is determined by cross-referencing the date value in sheet1! A9, with the sunset database.
If it needs lights, variable lghtson is calculated equal to "sunset"-30 minutes.
As I step through this code:
WorksheetFunction.VLookup(facb, fac, 6, False) = "Y" Facility has lights. Check to see if lights are needed. sunset = WorksheetFunction.VLookup(tempws.Range("A9"), sun, 2, False) sunset=0.879166666666667 which is 9:06PM. This is a proper value from the lookup. If rental_end.value > sunset Then rental_end (value from textbox) = "9:30 pm" , sunset=0.879166666666667. This is true, and Excel accepts it as true ... lghtson = sunset - 0.5 0.379166666666667 = 0.879166666666667 - 0.5 (9:06 AM)
This is not the value I was looking for. I was looking for 8:34PM (0.856944444444444)
I have a workbook with macro button to run some vba, if i want the button to disable when the user make copies of the workbook (date created is later than original wb saved time) what codes to add in the VBA?
what i assume is to add the time to a cell when the wb is saved, when the wb opens, it check for that cell if the same with the date created, if different, then disable the macro button.