Copy Lines Depending On Agent Selected And Date Range
Feb 3, 2010
I am having issues with this Macro since I have to run it on computers only supporting Excel 2003 and computers with Excel 2007. The Macro in use is as follows:
--------------------------------------------------------------------------------------------------------------------------------
What I would like to do with the information that I have put together on a different workbook is to reference an Agent (column A), and a time range (Date is in column D) and then copy the row from A to I for each occurrence during that range of dates so we can see how many and what errors have occurred during any range of dates selected. (I will have different people inputting errors at different times so the dates will not be sorted unless they have to be). I want to be able to select different agents/date ranges to be able to get a glance of how that particular agent did during this time frame.
Here is an example of the work sheet where the data is originaly.
[Removed]
Here is an example (in a different workbook) of what the sheet should look like if I was searching errors for Albert Ozier between 1/25/2010 and 1/28/2010.
Im looking for a macro that can get a cell RANGE, the data in the RANGE will be copied then if the checkbox is selected it will copy the same data in the RANGE and add the selected checkbox in next column
I have column A and Column B < this is my selected range
Capture1.PNG
I will have a form that has checkbox and buton.
When all the checkbox is selected. when the button is click. the result will be.
The rows will differ depending on the Active Cell that's selected and I don't know how to specify this. The range I want to copy is from Column B to DA on the worksheet ("Staff") which I want to paste to another worksheet ("Leavers"). This is as far as I got
'FindRemove = lstRemove.Value 'If FindRemove = "" Then End
' Goes to the start of the Data column 'Sheets("Staff").Select 'Range("B4").Select
' Tests current cell against FindRemove 'Do 'If ActiveCell.Value = FindRemove Then 'Call CopyPerson 'Exit Sub 'Else: ActiveCell.Offset(1, 0).Select 'End If 'Loop Until ActiveCell.Value = "" 'End Sub
Using macro's on Excel 2010. What I'm trying to do is create a macro that will copy a range of cells from one sheet to another depending on a option being selected from a drop down box. I've tried to use formulas but without success. sheet 1 contains a list of approx 20 people with rows containing sales figures per week.
Is it possible to have a macro that will copy the rows to sheet2 depending on the dropdown? The drop down has already been setup with people's names
E.g. if sheet 1, cell a1 (with data validation setup) dropdown contains "mr smith", copy sheet2 row A1:A9 to sheet 1 cell a2 or if sheet 1, cell a1 dropdown contains "mr cooper", copy sheet2 row B1:B9 to sheet1 cell a2 etc... for each name in the dropdown
The idea is so that i select a dropdown and it copies the sales figures that match the dropdown name, if i then select another dropdown, the corresponding figures are copied to the same place.
I could make sheet 2 in to a list and sort it that way. but what I need to do is pull the information into sheet 2, it's no good being able to sort it on sheet 1.
This spreadsheet must perform calculations for every line since new items are added every day, so VBA is probably better than copying formulas down every line of the spreadsheet:
With the press of a button, I need to be able to select a range of dates and copy all lines within the range to a seperate sheet with the desired name under the same headings they currently reside under. I have included some modified code that is being used in another spreadsheet that was created for me, but I do not pretent to understand all of it and I no longer work with the creator of the spreadsheet. How do I use a button to open the form for date selections and entering the name of the new sheet, and then use the start button on the form to begin the matching and copying to a new sheet? If there is an easier way I am all for that too.
Also, I need to keep a total of all items by month as well as a monthly and annual average of the Total Item Value on the FY09 tab. This will eventually produce another sheet when a button is pressed to submit as a report. I think part of this answer is in using the MONTH(serial_number) function but I can only get this to work for a single cell. I need to search the entire Distribution 'D' column, match all the months to the FY09 tab to the respective month, and calculate the totals and averages. I think SUMIF may also be needed as well but need the MONTH(serial_number)to work first. If there is a way to code all of this in VBA that would be fine as well.
I have a pivot table on Sheet1 where I am trying to get the totals and averages described above but I am not sure it can do what I need. In column 'B' I need the total number of each item as well as the total number of all items. I tried various formats and adding the totals from the Totals tab but I have not figured it out.
I have an excel spread sheet that is quite large it hold events for a piece of software that we are using what I am trying to do is display the last time was successful and the last time something failed
What I Want Return the MAX Value of the cells in a Column labeled start date for the rows where a Column labeled Agent =X and a Column labeled Mission Type = Y
In plain English with an example In another Cell I want to display the most recent start date for a mission of a particular type for an agent
Using the following table as an example I would like to determine the last time Agent 007 was on a Mission of type a
The Expected result should be 6/23/2008 If the same was asked for agent 99 the result would be 4/20/2008 And again for 66 the results would be 5/2/2008 If we then changed the mission type to b the results would be 007 6/23/2010 66 5/2/2010 99 4/25/2010
Here are the formulas i have tried already the results for these were incorrect and exactly the same 6/23/2012 the formula seems to be ignoring the first value and just calculating the last column to the latest date
"Sheet1" of Book1.xls contains the daily efforts of each members in the team. The detail changes automatically everyday like:
Date Name Task1 Task2 Total 1/1/08 Mark Design-2 Analysis-2 4 1/1/08 James Design-3 Analysis-2 5 1/1/08 Paul Implement-4 4
On the very next day the details will be automatically changed as:
Date Name Task1 Task2 Total 1/2/08 Mark Design-2 Analysis-4 6 1/2/08 James Design-3 Analysis-2 5 1/2/08 Paul Analysis--8 8
i.e. "Sheet1" will contain only the details of current date. I have managed to do it in "Sheet1"...
Here I need to add all the details automatically for each and every day in a separate worksheet ("Sheet2") from "Sheet1" of the same excel.
As soon as the date changed, then it will be reflected automatically in "Sheet2" in the next blank row for each member of the team... The details of "Sheet2" will be:
Date Name Task1 Task2 Total 1/1/08 Mark Design-2 Analysis-2 4 1/1/08 James Design-3 Analysis-2 5 1/1/08 Paul Implement-4 4 1/2/08 Mark Design-2 Analysis-4 6 1/2/08 James Design-3 Analysis-2 5 1/2/08 Paul Analysis--8 8
i have a excel sheet which i use to schedule my service team. Basically i have horizontally the dates ((a colum for every day of the year) and vertically the guys names (about 25 rows).
I would like to add a function so i can push a button and i automatically print the past, current and next week of my shedule on one page.
In addition it should print my usage chart which is on a different work sheet in the same file.
I have a large table in the final tab of my excel book. This table contains data such as Company name, contact details, etc but also a date which I must contact them on (this is nothing sinister, just a curtsy call following a job ).
The problem I am having is that I am running a vlookup on the first tab on a cell referring to todays date. This only brings shows one record which is the first occurrence of this date. This isn't very useful to me
The problems I need solving are:
I would like to be able to vlookup a range of dates (i.e. 7 days before or after todays date) - how do it do this?
I would also like to be able to return multiple results (i.e. if there is more than one company within that date range I would like them to show).
I have 2 worksheets, 1 with a table sorted like this (in a row):
component | start date | end date | assigned to
Second worksheet with a table like a calendar with dates and people (dates in the columns and people in the rows), every component is assigned to each person by dates.
I want the assignment from worksheet 1 to worksheet 2 to be automatically. i will set the start and end date next to the component in the first table and assign it to a person/s and it will be automatically get filled in the second worksheet (the calendar) under the person/s and under the same dates as set in the first worksheet.
I have a table that looks like this (its basically a historical data of a stock exchange):
Date Index January 4, 2010
[Code]....
The List continues till the current Date.
I want to calculate Average Index Values of a Date of each month within a Date Range. Example: Calculate Average Index Values for 3rd of Each month from 1st Feb 2010 to 3rd Jan 2011. Formula should calculate Average of the Index Values for 3rd Feb 2010, 3rd March 2010, 3rd April 2010, 3rd May 2010, 3rd June 2010, 3rd July 2010, 3rd Aug 2010, 3rd Sept 2010, 3rd Oct 2010, 3rd Nov 2010, 3rd Dec 2010, 3rd Jan 2011.
Both the Date and the Date Range is variable. Also, the Index Value for selected Date of one or more month may not be available as that being a holiday. In that case, the formula needs to use the last available Index Value before that Date. e.g. If Index Value for 3rd Oct 2010 is not available, system will use the Index Value of 2nd Oct 2010.
I have a budget worksheet that uses a spending forecast sheet to determine where the spending level for each budget code should be to the end of the current month. In other words, the Forecasted YTD To Month End fomula for each budget code in the budget worksheet is simply:
=SUM(Forecast!D8:F8)
Where column D is Jan, E is Feb, F is Mar etc in the forecast which distributes the budgeted amounts by month.
In each row on the budget sheet I want to evaluate today's date and if we're in March I want the formula to read as above but when we move to April I want it to use G as the end column in the range to sum.
SUMIF seems cumbersome in this circumstance and I wonder if a UDF might suit better.
I have a Master workbook with 4 sheets named WEEK 1 to WEEK 4. At work we work around 13 4 week periods and need this workbook to be dated accordingly, that is Period 1 Week 1 and date of first day (Sunday) of that period. The ideal solution would be for the user to enter 1 to 13 into a cell and via a button all dates to be populated and a new workbook created for that period. I have attached a sample workbook with the 4 weekly sheets and a date range on another sheet to show the range I need the dates from. I hope the workbook explains what I need better than my explanation here!
File A has patients with discharge dates over two years. Each patient may have multiple dates. Example:
Patient Discharge Date John Smith 7/1/2012 John Smith 10/1/2012 Judge Judy 7/1/2013 Judge Judy 12/1/2013
File B has office visit dates for the patients. Again, each patient has multiple office visits. I need to be able to see which office visits were within 15 days of a discharge date. Example:
Patient Office Visit John Smith 6/1/2012 John Smith 6/15/2012 John Smith 7/10/2012 Judge Judy 7/20/2013 Judge Judy 12/12/2013
Is there any way to note next to the discharge date that for John Smith the 7/10/2012 office visit was within 15 days of the 7/1/2012 discharge? And the same for Judy with the 12/12/2013 visit?
I have a code that will allow me to copy three worksheets from an open workbook to a new workbook. That works great, but I only need only a selected range from each of these worksheets to be copied (Range A1:AV60). Here is the code I use to select and copy the worksheets, how do I add a range within this code for each worksheet.
I am trying to create a method to select the values of contiguous range selections on excel worksheets.
Users will be making new worksheets in new workbooks out of the data from the old sheets.
Currently users make a selection is and copy it to a new worksheet.
Is it possible to retrieve from the 'clipboard', the values from the associated cells?
And then to parse them into columns in a new worksheet?
Earlier I tried this bit of ( it didnt work )
Sub AddNew() ' for passing highlighted text into the form so that I can pass it 'to a new workbook. Dim PassData1 As String Selection.Value = PassData1 Set NewBook = Workbooks.Add With NewBook .Title = "xxx" . SaveAs Filename:="xxx.xls" End With Range("A1").Value = PassData1 End Sub
I also use VBA in a terminal emulation program that I use the following command to 'screen scrape' the current display memory and quickly Save it to a .txt file:
.SaveDisplayMemory "C:File1.txt", rcOverwrite What I want to do in Excel is, Copy the current selected Range() and Save it to a .txt file.
I know how Save the current Sheet to a .txt file, but can't figure out how to Save just a Range() of cells.
Adding ' in the beginning of a line converts the rest into comment line. I wonder if there is an easy way to convert a huge area into comment line to try something on code. I couldn't find such an option in the menu.
I am carrying out some sensitivity testing on a model, and would like to greatly increase the speed of the process by being able to call in from a user defined cell a named range, which is then pasted to the right of the cell.
The attached file steps through the process I have in mind.
I have a worksheet with some info that is filled in from other employees. I have Customer Name, Date of Oldest Invoice, Avg. Days Beyond terms in column N42:N44, with the data in column M42:44. I want to copy and paste that into another workbook, I need to transpose the data and then paste it into the next blank row. IF POSSIBLE, I would like to have some of the column headings the same as the above fields, and I would like to paste the data into the correct column heading.
Currently I have the code listed below. It copies the data, opens the spreadsheet, (this is where it fails) find the next blank row and transpose and paste the data. It does transpose and paste the data but it does not look for the next blank row, instead it just transposes and pastes the data in the last cell that was active when the work book was closed.
Code:
Private Sub CommandButton1_Click()' Paste Macro ' Macro recorded 5/14/14 ' ' Range("O42:O47").Select Selection.Copy
Workbooks.Open Filename:="L:Financial Services! FRA !! Preston !3rd Party Collections Accounts 2014.xls"
I merged about 15 adresslists from media contacts to one excel list. Each list had a name i.e. music, health, theater, etc. and the same logic in colums. I added a few columns and have 1 large list now.
As some journalists write about music & health & theater, architecture, etc. they are listed up to 10 times in the new list now. But the "genres" from the original list i.e. music, health, theater, etc. are in different columns. Some of the lines have empty fields (i.e. no address or mail)
All I want to do is have one line with all the information of all 10 lines in it, merged, dupes removed:
company - firstname - lastname - Adress - Mail, etc. : genre: music - health - theater: example.xlsx
I atteched an example of the full list and the result i want
MONDAY xxxxxxxxxxxxxTeam1 | Team2 | Team3 | Team4 etc. Hours State1 - Hours State2 - Hours State3 - etc.
TUESDAY xxxxxxxxxxxxxTeam1 | Team2 | Team3 | Team4 etc. Hours State1 - Hours State2 - Hours State3 - etc. WEDNESDAY xxxxxxxxxxxxxTeam1 | Team2 | Team3 | Team4 etc. Hours State1 - Hours State2 - Hours State3 - etc.
Each team leader would then input hours in each state each day on their column. Make sense? Easy Peasy...
My question........... is it posible to have a userform where a TL would select their name (Column) and Day (Monday=Row 3, Tuesday=Row23 etc) from a dropdown and then input figures in txt boxes to submit them in the correct location?
I have a sheet with a country in it in A1 (validation list).
Depending on the country in A1 a country specific IF command has to be executed on a column1 with first cel = A3. This IF command also relies on the values in column 2 and 3 on the same row. (B3 and C3 are in the IF cmd)
I taught to do it like this : =IF($A$1="Spain";$A$5;0) with A5 being the country specific IF command which should be executed when spain is selected. however when I do this, this only works for the first cell ( I cannot drag this formule down, since it will always give the value calculated in column 2 and 3 on row1.
I'm not sure if the best way to 'select' the country specific IF cmd is with another IF command..
Hi. Does anyone know a formula to copy a selected range of cells on sheet one to a range on sheet three when a check box in checked. Ex. copy range a4:j4 on sheet one into a4:j4 on sheet three once the check box for on sheet one is checked?
I am using this code to hide or unhide rows of text on another sheet:
VB: Sub ProcessSheet1ChangeOnCellJ7(ByVal Target As Range)
Dim sAddress As String Dim sValue As String
'Get the address of the cell that changed without '$' signs sAddress = Target.Address(False, False)
[Code]....
When the "Not Pursuing" list box option is selected (in cell "J7" or "J8" in Sheet 1) I need to add (or over-write) "Not Pursuing" to the range of cells in column "B" (in the "Tasks" sheet), but only for that particular Goal, meaning a limited range of cells in column "B". If the "Pursuing - Show All Tasks" option is selected for a Goal then these same cells need to be blank so that the appropriate person can enter their name into the cell.
The purpose for adding "Not Pursuing" automatically to these yellow highlighted cells is that it will facilitate filtering of tasks by individual in the "Tasks" sheet..
Again I have tried several times to upload a sample file and am unable to, which I know makes it more difficult to solve. (Is there some common mistake people make? I know it's an allowed format and is very small in file size....)
Code solution can be entered directly beneath:
VB: If Target.Value = "Not Pursuing" Then ActiveWorkbook.Sheets("Tasks").Rows("29:29").EntireRow.Hidden = False ActiveWorkbook.Sheets("Tasks").Rows("30:48").EntireRow.Hidden = True
In my userform I have a list of check box's that can be selected. Currently if more than one is selected, they will appear in the spread sheet in the same line one after another with a space between them. How do I make it so they either appear with a comma appearing after each, so the next value appears on the next line below or most perferably the cell turning to a drop down list with the values?
Current code
VB: If CheckBox1.Value = True Then ws.Cells(iRow, 2).Value = ws.Cells(iRow, 2).Value & " " & CheckBox1.Caption If CheckBox2.Value = True Then ws.Cells(iRow, 2).Value = ws.Cells(iRow, 2).Value & " " & CheckBox2.Caption If CheckBox3.Value = True Then ws.Cells(iRow, 2).Value = ws.Cells(iRow, 2).Value & " " & CheckBox3.Caption If CheckBox4.Value = True Then ws.Cells(iRow, 2).Value = ws.Cells(iRow, 2).Value & " " & CheckBox4.Caption If CheckBox5.Value = True Then ws.Cells(iRow, 2).Value = ws.Cells(iRow, 2).Value & " " & CheckBox5.Caption If CheckBox6.Value = True Then ws.Cells(iRow, 2).Value = ws.Cells(iRow, 2).Value & " " & CheckBox6.Caption
Spreadsheet current cell appearence if all 6 are selected ' Chinnook EH101 Lynx Puma Sea King Fixed Wing'
Required appearence: Chinnook EH101 Lynx Puma Sea King Fixed Wing