Excel 2010 :: Function For Last Modified Date Of Cell?
Feb 14, 2012
What I wanted was to a function, say, "=LastModifiedDateOf(CELL)", where CELL, is a parameter that indicates the cell I want to monitor. If the value of such cell ever gets changed, the cell containing the function has its value updated to the current date.
A1 = "AA"
A2 = "=LastModifiedDateOf(A1)" -> "10/03/2011 10:30:32"
I need to insert a date modified column to an Excel 2007 workbook I am currently using. The columns range is from A to L, with about a hundred data points. However, I would like to have the date modified cell update only when there are changes to rows F through L, starting with row 3.
I need the code to still function if I add rows, and it would be great if it would also still run if I added columns, but that part is not necessary. I've gotten close by defining a cell name as myCol and using this code:
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Count > 1 Then Exit Sub If Target.Row < 3 Then Exit Sub
I'm using Excel 2010. I have three columns. Column A contains the date, Column B contains the time, and Column C contains the date and time. Column C is the result of a formula, which adds Columns A and B (ie. =A2+B2). So I have the following...
Date Time Date and Time
1/15/13 9:00:00 AM 1/15/13 9:00:00 AM
1/15/13 9:00:05 AM 1/15/13 9:00:05 AM
I'm using a defined name to store a date and time, which I'm going to use as a lookup value in a Match function. I've defined MyVal as follows...
1/15/13 9:00:20 AM
Excel automatically converts this to the following decimal number...
When I first run either of the following two macros, they correctly return 5...
Code: Sub test1() Dim x As Double x = [MyVal]
Debug.Print Application.Match(x, Range("C2:C10"), 0) End Sub
Sub test2() Dim x As Date
x = [MyVal] Debug.Print Application.Match(CDbl(x), Range("C2:C10"), 0) End Sub
However, when I save and close the workbook, and then re-open it, these macros both return an error. Is this some sort of bug in Excel?
I'm trying to sort all .xls files in a folder by modified date. I want most recent at top because then I will be cycling through and using the most recent version of files that have similar names.
The code I have so far is this:
Code: Sub autolink() Dim folderPath As String Dim FileName As String Dim wb As Workbook
But I need something before it sort the folder by the modified (or better creation date) because there are several files with similar names. I know know, I could put a date in the file name and look for that but I don't control the naming of the files.
I want to know if there is a way to have a cell beside a series of cells that will change its date (and time) when any of the cells in the series is changed.
On a single row, I have four materials that total to a fifth cell. The 6th cell in that row, I would like to have a "date last modified" that would change if any of the first five cell's value is changed.
I have a spreadsheet where we will be inserting the Arabic Hijri date taken from a Customs document (bayan). On my spreadsheet I'd like to have a column immediately next to the Hijri date that would convert the Hijri date to the Gregorian date so both dates will be visible for our Arabic and Western personnel who will be using the spreadsheet.
I have a workbook that column C has computer names starting from C4 to C83. I need to get the Datelastmodified of a log file that robocopy is writting to the following path. \Server1folder1WorkSheetName\%computername%somefile.log. The Datelastmodified needs to be entered in column K for each computer name in column C. One last thing would also be great is if the file does not exist it would write a error value.
I have a userform which requires the user to enter the date a training course was completed. Initially I used DatePicker as I was running Excel 2010 and had that working, however the workbook I am creating will be used on about a dozen machines, all of which have different versions of Excel. To avoid needing calendar Add-ins to be downloaded and installed for this feature I decided to go the vba created calendar route. I am using one I found on this forum: [URL] .....
It works well for me using the example spreadsheet provided in the post but I am having some difficulty incorporating it into my code. I believe I have imported the appropriate forms and modules because I can get the date populate to the Label Box on my userform but when I try to put the Date into the spreadsheet along with other data such as name and course duration, the name and course duration populate but the date cell remains blank and execution completes without error.
I have tried playing around with the data type thinking I had some issue using the .Value attribute with a String but .Text gives me an error as does converting from String to Number format.
I will attach the workbook but for a quick look, the portion of the code I believe that is not working is in here:
I came across this excellent code here on this site but it does the opposite of what I need. This code deletes empty or blank rows if the cell in column I is blank. I actually need to delete the row if the cell in column I has a date or any data. Using Excel 2010.
Sub deleteBlankRows() On Error Resume Next Columns("I").SpecialCells(xlCellTypeBlanks).EntireRow.Delete End Sub
I'm working in Excel 2010. I'm trying to create a dynamic range, using the OFFSET function. I've got it working beautifully but as soon as I save it and close the Name Manager the range stops working. When I go back into Name Manager I find all the cell references have changed (from C1:C600 to C1048572:C595 - or some other strange range).
P.S. What it's doing isn't so important as when the cell references are right it works. But just for full info: It's an OFFSET function, starting at A1. It will look at a list of companies and use a Match function to find out how many rows to offset (based on where the first instance of a particular company. And it uses the COUNTIF to make the range the same number of rows as there are entries for that company.
I needed a code that would input the current date and time in the cells in column N whenever changes were made to any cells in the row from columns A to M. For example, if I change a name in cell 6D, then cell 6N would automatically change to the current date and time.
I found a useful code on a forum (maybe here, don't know for certain) and modified it to suit my needs (see below). I am however now getting a debugging error suggesting that the second line that reads "Private Sub Worksheet_Calculate()" is causing an error.
I'm having trouble using the worksheet copy command in a VBA subroutine. I have the following line in my code:
When I step through my code and execute this line, the sheet is copied as expected and put in the correct place, but then instead of the next line of code being highlighted, the pointer jumps to the first line of a function (in a different module) in my code.
I am using Excel 2010. I have a user form with a date picker on it. I simply want to transfer the date chosen to cell A3 on a sheet. I have two problems. When I click the date picker, it doesn't show all the days of the month. When I do pick a date, it isn't transferred to the sheet. This is the code I am using in the user form:
VB: Private Sub DTPicker1_CallbackKeyDown(ByVal KeyCode As Integer, ByVal Shift As Integer, ByVal CallbackField As String, CallbackDate As Date) meetdate = UserForm2.DTPicker1.Value Sheets("MeetData").Range("A3").Value = meetdate End Sub
I don't really know VBA more than just piecing together other people's work (so please dumb down your responses as much as possible).
So I would like to have a function that displays a filename within a cell. The filename I need to display will start with "cost" and have a date at the end (not always the same number of characters). I need to search a folder for all files that contain that text and return the last modified one.
I found this VBA code that returns the last modified file, but only filters based on the extension (which I would like to keep in the code as well).
I am trying to perform the following, but am unsure if a macro is needed, or if there is a way to do it by possibly modifying the transpose function. Here are the steps required:
1 - copy a selected range of cells from a single row in one worksheet (i.e. D3:AE3).
2 - paste the data from those cells into a selected range of cells from a single column (i.e. A1:A14) in a separate worksheet BUT skip the cells from D3:AE3 that were blank instead of having them create blank cells in the column of the target worksheet
3 - Need to maintain a reference back to the original row of cells so that if their values change (i.e. D3 from source), the corresponding values in the new column (i.e. A1 in target) are auto updated.
I have userform with date pickers and have text boxes overlaid on these, when I select todays date from the date picker it does not display the current date in the text box (I have 8 date pickers on the userform). If I select another date then reselect the current date it works. It has occasionally worked but why.
Below is the code for populating the text box from the Date Picker.
Private Sub DTPicker1_Change() TextBox1.Value = DTPicker1.Value End Sub
The initialize userform code uses the following to format and set the textbox
I have an excel spreadsheet with multiple file names (including file path) listed in a column. I have to update other files using these 'underlying' files. So each cell has the file path and file name (i.e. Q:FolderFile Name.xls). I would like to have the adjacent cells indicate the last modified date for each file. This saves me time from looking for the last modified date manually across different folders in my servers to see if the 'underlying' file has been updated, which I would need in order to update my other files.
So this function would be something like "get last modified date based on file path". I will need step by step instructions as I am not very familiar with VBA.
A B 1 Q:Folder1File name1.xls 2/10/2012 2 X:Folder2File name2.xls 12/1/2011
I have a number of excel files in a directory that require me to take action after a file has been saved. What I want to do is create a macro that will look to each file and retrieve its 'modified date', then put that into a spreadsheet. What would be ideal is to create a User Defined Function to look at the last modified date of a file in the cell next to it (I have the files names in a spreadsheet as a hyperlink).