Excel 2007 :: Adding Date Last Modified In A Cell Using VBA?
Jul 10, 2012
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 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.
Excel 2007.
The code I have so far is this:
Code: Sub autolink() Dim folderPath As String Dim FileName As String Dim wb As Workbook
[Code]....
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.
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.
E.g. A1 = "AA" A2 = "=LastModifiedDateOf(A1)" -> "10/03/2011 10:30:32"
Below Macro which I am using to extract .PDF files. Now, I also want to see the Date moified while extracting the .PDF files. Hence, adding date modified to this macro.
Sub get_pdf_name() Dim FR As Long, sh As String, FPath As String, FName As String sh = Sheets("Sheet2").Name FR = Sheets(sh).Range("A" & Rows.Count).End(xlUp).Row + 1
My group is putting "marks" in Excel (2007) work papers & sometimes they may want to add additional marks to those previously added in a selected cell. What I have below actually works, but I just got my VBA book last week & there has to be a better way.
Specifically, I've saved the "target" off in the same worksheet (That can't be good.) and delete it when I'm done writing it back. Can I save the original characters virtually, or to the personal.xlsb.
Code: Sub addMarkInCELL() ' Dim charCount As Integer Dim charStart As Integer Dim rngTarget As String charCount = ActiveCell.Characters.Count
I have a spreadsheet which contains 2 drop down pick lists in Field1 and Field2.
Code: FIELD1 | FIELD2 | FIELD3 -------------------------------------------- In Cell A2, I have this set in Data > Data Validation:
Allow: List Source: =CatList
If the user selects a value from the CatList range, then the drop-down options in Field2 are updated accordingly.
In Cell B2, I have this set in Data > Data Validation:
Allow: List Source: =INDIRECT(A2)
The Ranges are as follows:
Code: Cat1 | Cat2 | Cat3 --------------------------------------------- Cheese | Hat | Square Trees | Cat | Circle Bees | Sat | Triangle Knees | Mat | Rectangle Apologies | Bat | Octagon
I'd really like to be able to add a message into FIELD3, which is based on the value in Cat2
e.g. using pseudocode, something like:
If Field2 value = "Apologies" then put this message in Field3: "This requires approval from A" elseif Field2 value = "Triangle" then put this message in Field3: "This requires approval from XYZ" elseif Feidl2 value = "Bat" then put this message in Field3: "This does not require approval"
Basically this is for an access form, and I need to be able to add a feedback message to field3 based on what's in Field2.
I thought about using the INDIRECT option to add messages but I can't see how I'd do it. Maybe VB would do it, but I don't know it well enough.
I have a few dozen pictures created when a macro runs. They all have unique names. I'd like to add comments to cells, where the cell.value decides which picture to pull. All the examples I've found online show how to do this if you have pictures saved on your hard drive by referencing the file path "c://mydocs/...blahblah/"
Is there a way to reference the pictures I've created/named with my macro?
Here's the snippet of code that creates the pictures and names them:
Code: For i = 2 To Application.CountA(Sheets("Allocation").Rows(1)) Sheets("Allocation").Activate Set rInput = Sheets("Allocation").Range(Cells(1, i), Cells(10, i)) sPicName = "_" & Sheets("Allocation").Cells(1, i) & "_" sSheet = Sheets("Allocation").Cells(3, i) dDate = Sheets("Allocation").Cells(5, i)
[Code] ......
Here are some examples that are close to what I'm looking for.
VBA Popup Pictures - 1108 - Learn Excel from MrExcel Podcast - YouTube VBA Express : Excel - Add pictures that float like comments.
I'm using Excel 2007. I would prefer to stay away from the scripting side of the house if possible. This is basically a 3 day forcast weather chart. The top is the actual weather data, the bottom portion is a color coded reflection of how the weather affects various things.
This product is created in excel, but will be embedded into a powerpoint. It will be updated daily. Here is what I would like. I want the color chart at the bottom to update automatically based on the data I enter above. I have a grasp that I can update the color through conditional formatting, although im not exactly sure what that will look like with all of those cells.
I also figured out that I can insert the letters in those lower cells with something similar to " =IF(C6>90, "T", "") " which would put in a 'T' for Temperature when the temperature got above a certain degree.
I run into a problem when I have multiple factors affecting a single cell. For instance on the example in day 2 of my image. Personnel are affected by Temperate AND UV Index. How would I set up that cell to pull that information from both of those cells and display it accordingly? I would prefer the letters to stay separated by the comma, but I could live without that. The default cell color will be green, with the potential to be yellow or red. I left a few examples of possible situations on day 2 and 3.
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 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 am just starting to learn about VBA and I have a range of data from collumns A through R. I would like to develop a macro that would place a time stamp in column S whenever the data is modified.
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 work for a UK charity and have a list of funders in an Excel 2007 spreadsheet.
One of the columns refers to the date on which a new application for funding can be made to that particular funder.
In many cases new applications for funding can't be made for 1 or more years since the last application - sometimes as many as 5 years later. How to get a cell to refer to the date that it contains.
For example, say I have in cell A1 "The Acme Funding Organisation" and in cell B1 (i.e. the "Reapply when?" column) a date of 01/04/2013 (British date format, i.e. 1 April 2013) then what I want Excel to do is to look at the date in cell B1 and if that date has been reached to highlight the cell red. That way I'll know that the reapply date has been reached & that a new application can be made.
I am using the code below (Excel 2007) to delete and add back timesheets based on a list of names from the "Names" tab. In addition, I am making a "Table of Contents" with hyperlinks on a separate worksheet that will allow employees quick access to their timesheet without having to look at each tab. The code below works well if I want to delete and add back all the timesheet at one time but if we get a new employee in the middle of a pay period I have to use a single timesheet until the end of the pay period.
What I would like to know is, can the code below be modified so that when the code is run it reviews the list of names and only adds a new timesheet for that employee without deleting and adding back all the timesheets?
I have an Excel 2007 template which is used for data entry. I want to disable cut, copy and paste functionality and have disabled shortcut keys via VBA and used CustomUI to leave a bare ribbon. However, a user can still add cut, copy and paste buttons to their quick access menu. Any way to prevent this?
but my code is running in a loop and i can see that atleast 20 buttons were added and it fails to select when it try to add this iteration. It is completely confusing me.
I also notice that when it fails, on select method .. the button was actually added to the sheet with caption/name as "Button 65536" but then fails to select it. What makes the select to fail after adding the button? Could there be anything special with Button 65536?
Is there any better way to code the adding button and setting action and name for excel 2007?
note before entering the loop i am deleting all the shapes with myShape.Delete which name matches "btRun"
I have a table of data (total 142 rows). Column contains dates, in the format dd-mmm-yyyy.
I tried to filter using DATE FILTERS->EQUALS and in the custom filter window, I chose EQUALS then picked a date from the date picker icon. The date I picked was 5/4/2009 (this is May 4, 2009, formatted automaticall by excel as m/d/yyyy).
When I clicked OK, nothing showed up despite the fact that there are 6 occurences of May 4, 2009 (formatted as dd-mmm-yyyy in the data table)
So my questions are:
1. Is this due to the formatting?
2. Is there a way to change the date format supplied by the date picker?
The code below scans from the column on the row of the worksheet till it finds a blank, this seems to work ok as I previously had a msgbox in that displayed the value of n once the loop finished
So I was hoping that the values in the columns on that row would be added to the combobox but for some reason I get a typing missmatch error.
Code:
Dim n As Integer n = 1 Do While LValue6 "" 'find out how many alternatives there are LValue6 = FoundISBN.Offset(0, 32 + n).Value n = n + 1 DataInput.ComboBox1(n) = LValue6 - I was hoping that the value in the cell was added to the combobox Loop
I have a Excel 2007 spreadsheet of part numbers and quantities sold. In the spreadsheet we have similar part numbers, but my sumif command is adding these together. the parts are :
0124225031 R124225031
My column of part numbers is formatted as text
My formula is this =SUMIF(Sheet1!H:H,A16,Sheet1!Q:Q) where H is the part number and Q is the quanity
I tried adding a format command in the sumif command, but it returned a 0. =SUMIF(Sheet1!H:H,format(A16,"0"),Sheet1!Q:Q)
better formula and why is excel adding different part numbers together?
I am trying to extract values from a text string and add them up in Excel 2007. So far i have been successful in extracting the value out of the text string like this - =MID(I6,AD6,3) where AD6 holds the position number in the text string to start from. So it's working OK for one row but i need to do the same thing on multiple rows where the text string can be in different columns and I'd like it to automatically pick up the non-blank cell.
each row only has one column with text in it and the value i need to extract is always after "$". this is a working spreadsheet so the text string could move from column to column over time and I'd like my formula to be able to detect which column to read from. I then need to add up all the values from each row.
I currently have the following Macro for one of my many checkboxes in 2007 Excel:
[Code] .....
It works perfectly until additional rows are added/deleted before the indicated rows in the code (It changes the number sequence in the workbook). The number sequence stays the same in the code which means I am now hiding rows either before (delete rows) or after (insert rows) the intended rows I want to be hidden. Is there a way to change the above code to remain with the assigned rows regardless of the adding/deleting of rows before it?
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.
Example:
A B 1 Q:Folder1File name1.xls 2/10/2012 2 X:Folder2File name2.xls 12/1/2011