Macro Code To Amend The Status Of Cell To Be Date?
Mar 31, 2014
I have a user form we are using to transfer data into an excel spread sheet. When transferring the date from a text field it is formatted as general, I need this to be a date format DDMMYYY. The cell needing formatting is N2
I have the following code kindly supplied to me by someone else and I'd like to know if anyone can suggest any ways to speed up the running of it. It currently takes about 4 minutes to run (there are about 5000 cells to loop through)
Basically it looks for a value in Col C - works out the number of rows to fill up by searching a range in Col D - then copies value in Col C up by that number of rows.
I tried this macro, written by Leith, to organize a workbook of over 100 worksheets, all named as a 3 digit number. (001, 002, 007, 004, 018, 12, etc.)
For some reason, there was no order to the sorting. Can the macro above be modified to sort my sheets in numeric order?
How to amend existing code in a workbook that is used by many different users. I am working in Excel 2003. The existing code copies data from certain cells in the active worksheet (which is password protected) into a new worksheet and saves that new worksheet to a temp folder, sends it to a particular email address using outlook and closes it, returning the user to the first workbook. You will see that it also unhides then rehides columns of the first worksheet during this process so that the user never has to see them. Problem here is that none of the users are using outlook anymore and I would prefer that this new spreadsheet that is created just be saved to the users desktop. I have found bits and pieces of what I needed on the web, but I can't seem to put it all together (I usually end up being sent to the debugger just short of having the newly created spreadsheet saved to desktop). Here is the existing code:
Private Sub CommandButton1_Click() Range("A2:G2").Select Selection.ClearContents[code]....
Essentially what I need to do is circumvent the whole email bit and save the spreadsheet that is created to the users desktop instead of a temp folder.
I have an excel file that we add data too for assignments and I want the date to auto popuate if the status is changed to Mitigated, Escalated, or offline. I wrote the below function which works but when i open it the next date the current date is written to those cells. creating a function that writes the date when the status is change and then leave the date alone unless the status is changed again.
[Code] .....
I have attached an example of what i have and below is the function
I'm trying to write a VBA script which will delete all rows in my Excel spreadsheet where Column I (which contains a status code) does not contain the word "Completed".
At the moment, I'm doing this the other way round: my script is able to search for entries in Column I which contain the status codes "Pending", "Awaiting Authorisation", "In Progress" etc and delete them. The idea is that when all those rows are deleted, I'll only be left with rows which have a status of "Completed". This works fine at the moment. However, the concern is that if a brand new status code is added to the data file, my script would be unable to pick it up and delete it. This is a small sample of the code I'm currently using (which deletes all the rows with statuses other than Completed):
I have 4 columns, If column B (Ref No) is filled in, the adjacent columns, C,D and E become mandatory and an input box pops up on screen one after the other for entry into each column.
My problem is that I require a drop down list and not a input box for the final column (status). So i have created a userform with a combobox dropdown. I am having problems connecting the combobox selection to the final column, and for the selected combobox item to go into the right cell like the input box entry currently does.
Attachment 53209test743.xls
I have attached a sheet and also you can see the code below.
Code in Sheet
VB: Public SaveVal1 Public SaveVal2 Public SaveVal3
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
I have found and adapted a macro (below) that searches all worksheets for a specific value (entered by the user in a specfic cell) then displays a list of hyperlinks to the matching cell locations.
I now have a couple of sheets I don't want to be included in this macro ("Master List" and "Pivot Table") but I'm really struggling to find a way of amending the macro to exclude these. I've searched and tried a couple of ways but I get errors and I think I'm not knowledgable enough to know where to put each bit of code.
I am currently creating a simple macro to save out files to a specific folder on one of our network drives. Since we will be doing this often I would like to amend the date the the file name saved for sorting/organizational purposes.
Unfortunately I have been running into a few issues, this is what I have tried so far but keep getting a SaveAs error:
I have cells in a column that record time in date. Unformatted it would appear as 19789.51407 but formatted to show time and date it would as appear as 3/6/54 12:20 PM. I am making graphs with the data and I want the title of my x axis to read "GMT Time (mm/dd/yyyy - mm/dd/yyyy)" or "GMT Time (mm/dd/yyyy)" depending on if the event spans more then one day. Using the following code, it almost accomplishes this.
Dim strDate As String Range("CO3").Value = Range("A3").Value Range("CP3").Value = Range("A" & Drag).Value Range("CO3:CP3").NumberFormat = "m/d/yyyy" If Range("CO3").Value = Range("CP3").Value Then strDate = "GMT Time (" & Range("CO3") & ")" Else If Range("CO3").Value < Range("CP3").Value Then strDate = "GMT Time (" & Range("CO3") & " - " & Range("CP3") & ")" End If End If
Where "Drag" is a variable that signifies the total number of cells in the column; ie the first and last dates. It compares the values and saves the results as a string. The problem is that when the string is saved it saves the date in mm/dd/yyyy hh/mm/ss. How can i separate the date from the time so I can have the title of my x axis appear as i need them?
Macro below - it now works and selects all the data in spreadsheet and converts to Proper Case
However I also need a macro to select all except the last column of data and convert all except the last column to Proper Case
It is for Post / Zip code info. so wish to keep it in Upper Case.
What I have already is:
Code:
Sub Propercase() Dim LastRow As Long, LastColumn As Long LastRow = Cells.Find(What:="*", After:=Range("A1"), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row LastColumn = Cells.Find(What:="*", After:=Range("A1"), SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column Dim r As Range, c As Range Set r = Range("A1").Resize(LastRow, LastColumn)
[Code] .....
I was hoping I could easily amend the above to select all except last column.
I have a Macro to protect all the Months sheets in my Time sheet to stop users deleting formulas, This year I've added a new sheet with a yearly calender so users can track Hols etc but when I run the Macro it protects this sheet "2007-2008". How can I amend the Macro so it protect all sheets except "2007-2008". My Macro is below:
Sub ProtectAll() Application.ScreenUpdating = False Dim ws As Worksheet For Each ws In ActiveWorkbook.Worksheets ws.Protect Password:="KITCHENsink19591968", DrawingObjects:=True, Contents:=True, Scenarios:=False Next ws ActiveWorkbook.Protect Password:="KITCHENsink19591968", Structure:=True, Windows:=False Application.ScreenUpdating = True End Sub
On a weekly basis I record payment terms updates and do this process manually. I compare 2008 terms against 2009 terms for any status update. I would like to provide a button to do the work for me. Can anyone provide code please?
I currently use this "IF Statement" =IF(C2=D2,"No Change",IF(C2D2,"Reduced")))
I have some vba code that currently copies a status table out of a worksheet, into a temp file for an email. The status table in excel has a column D which can have different status. I want to select everything in the table except rows that are 'Descoped'. Currently my code looks like:
Set rng2 = Sheets("Execution Status").Range("B2:F420")
This picks up everything without looking at the status. I want to change it so it doesn't pick up the rows where Column D contains 'Descoped'.
In pseudo code I would describe it as:
Set rng2 = Sheets("Execution Status").Range("B2:F420") where value in D5:D420 is not equal to 'Descoped'.
I have tried:
Set rng2 = Sheets("Execution Status").Range("B2:F420").Value "Descoped" and nothing gets selected.
1. If I enter a date in B3, then D3 will be S, and if I enter date in C3, D3 will be left blank while E3 result is D (Done). To have a clear view, I have attached the excel sheet.
I need to create a formula that will calculate the status of a customer based upon an input code and the relevent date.
The attached workbook is very simplified but should help.
Sheet1 contains the date of input (col A) for the client (col B) plus a code in column C to help ascertain the initial status of the a/c.
In Sheet2 (col B) I need a formula or possibly a VBA solution that will create a commission status for clients with 'N' in column C of Sheet1 which is current for 8 weeks after the input date in Sheet1. Thereafter this status then need to show say an 'S' for standard commission.
This result will be linked to the date shown in B2 on Sheet2. Just to make it clear, I only need a letter as the result to trigger off the actual commission calculations.
I wish to count the number of entries in a workbook based on the entries in two columns. The columns are for example H1:H100 ( date) and L1:L100 (status). I want to the number of times the date in H1:H100 is over 30 days old, as well as L1:L100 = 'Started' for example.
I have been looking for a macro (and have failed to find one) that would give a progress bar in status bar as a percent of the macro run time, e.g
If I had a macro that took say 5 minutes (which I would know in advance) to run is there a way to have a progress bar in status bar that would progress incrementally as a percentage of the 5 minutes or even simpler break the 5 minutes into 1 minute increments?
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..
I have a column which has dates in format: dd/mm/yyyy - there are no headers in this worksheet.
I need to sort the worksheet according to the row date field ... but it's causing issues.
It is assuming the dd is mm ... and when i reverse the format to yyyy/mm/dd before sorting - then it assumes mm is mm BUT it keep sorting with dd, regardless of the month. with both ways, the assumptions are interchangeable ...
I am working on a manning document which tells me when people report, and depart based on their job position. I have all of the info in one worksheet, and want to generate a bar like graph on another worksheet in the workbook (by just changing the cell color for ease) for a snapshot to view holes in job positions.
The snapshot worksheet has the list of jobs on the left, and months/years in a line acorss the top i.e.
2006 | J | F | M | A | M | J | J | A | S | O | N | D | Job Position X X X X X X Job Position X X X X X X
Here was the code I started with, and it doesn't do anything!
Private Sub Workbook_CreateCalendar(ByVal Sh As Object, ByVal Target As Range)
Dim Firstrow As Long Dim Lastrow As Long Dim Lrow As Long Dim Fcol As Date Dim Lcol As Date Dim Lencol As Long Dim CalcMode As Long Dim ViewMode As Long 'Set the Start Date of your Sheet Dim DatTim1 As Date DatTim1 = #1/1/2006#
I'm writing a macro that will pull a set of dates from a worksheet and put them into an array. Then I want to find the max date in the array (most likely using some sort of sorting method).
The code below is how I'm putting the dates into an array. I'm not sure if using the date data type is best. I can't tell how it will sort the information. Is there an easy way to find the maximum of an array of dates?
Dim Date_Array() As Date If Sheets("Sheet1"). Range("N" & i) = "Date" Then j = j + 1 Redim Preserve Date_Array(j)
I have the following columns that return cover period dates.
Start of Cover PeriodEnd of Cover Period01-Nov-0631-Jan-0701-Jul-0831-May-0901-Dec-0930-Jun-1001-Jan-1131-Dec-10
I however need a macro that will delete the cell contents if the "Start of Cover Period" (column AK) date is > than the "End of cover period" (column AL) date.
Thus it must compare ak2 with al2 and if ak2>al2 then clear both cells. if AK2
I have a company and I try to keep a record of all my clients in Excel. Below, you can find a simplified example:
2014-04-07_105615.jpg
Now, I have so many clients that my Excel file is quite large. So when I want to change the status of a contract, I have to manually look up the file number and change the status manually.
What I ideally would like, is a form that says:
Change status to paid: xxxxxxxx
Where the x's are, I would have to enter the file number, press enter and the corresponding status should change to "paid". I have about 30 contracts a day that change status. I tried to "draw" what I mean:
2014-04-07_110609.jpg
Is this possible in Excel? And how is it done then?
I have a worksheet with three columns in it. the first column is the "channel column", the second column is the "status column"; which indicates the status of the channel column wheter it is active or not, the third column is the "circuit name" column which indicates the circuit name for each channel. now, the status of the channel depends on the value of the circuit name column.. if the cell in the circuit name column is blank, the status column has an if formula that automatically changes it to vacant status, otherwise active.
i added command buttons namely "active" and "vacant". this buttons correspons to active userform and vacant useform when clicked. in each userform there is a combobox. My problem is how would i fill the combobox in the active userform with the active channels only , and same in the vacant userform with vacant channels only. the comboboxes list should correspond to changes in the status column, that is if one channel gets an active status it would be deleted from the vacant userform and be added to the active userform
Cell A1 value is: www.yahoo.com B1 Value should automatically show "Possible" Cell A1 value is: www.icallindia.net B1 Value should automatically show "Possible" Cell A1 value is: www.jigarparekh.html B1 Value should automatically show "notvalid"
I need a formula which can automatically see the status of the website address and updated in B column. which means that one dose not need to go to the website page to see if it is correct or not.
I have lot of website in the one sheet and i don't want to go all this website and check if they are correct. I want the status of this website in b column once when i have the website name already in the A column.