Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim VRange As Range
Set VRange = Range("Obj1")
If Not Intersect(Target, VRange) Is Nothing Then
Range("ObjDescr1").Select
ActiveCell.FormulaR1C1 = "=IF(Obj1="""","""",(IF(EmplType=""Salary"",VLOOKUP(Obj1,SalaryDevGoalsTbl,2,FALSE),VLOOKUP(Obj1,HourlyDevGoalsTbl,2,FALSE))))"
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
End If
End Sub
What it does, everytime range named Obj1 is selected, range named ObjDescr1 is populated to a Vlookup, depending on which type of employee.
I need the Worksheet Change procedure to handle Obj2 - 5. I want to Change Procedure to find out which named range Obj(n) is effected, and to do the rest on that one. ObjDescr(n) is also to match the value of (n).
How can I do this the most efficient way? I want to cut down on code in ever area possible, so I dont want to just copy and paste for obj1,2,3,4 and 5.
I'm playing with an excel file that has 3 different spreadsheets and basically the same layout just different product lines on each sheet. I need to find a snipet of VB code to change cell color depending on if another cell is used(filled in) or if it is blank. I'm very limited to my VB skills but can tinker enough to get what I need if someone points me in the right direction.
here is an example of what I'm trying to accomplish using the following Columns:
I'm trying to create an array formula that returns all the cities in a given state by imputing the state's abb in cell K2. The returned cities go into column J. California has the most cities(430) and the cities are 5000 rows deep.
I am looking to find a way and synthesize code that will prompt the user for text data when he/she clicks a radio button, then place that text data in a "Notes" worksheet within the same workbook. Given that there are multiple radio buttons, with options of "OK" and "attention needed" (it is a checklist of maintenance items), I also need to find a way to have each note listed sequentially in the notes worksheet. My questions: Is this possible using macros? Can you steer me in the right direction? (change event, inputbox, then what?)
i want to insert a range of cells from a worksheet onto a userform. how can this be accomplished? i use excel 2007, so theres no spreadsheet control. active x controls i dont know anything about and i heart its unsafe.
I have a very large spreadsheet with the following columns: WO# (number field); Start date (date format MM/DD/YYYY); Frequency (text); and craft (number). I am trying to have code that checks the frequency and if is "Monthly" or "Weekly" it just goes on to the next row; if it is "Annual", it adds 163 to the start date (start date needs to changed to a numeric field); if it is "Semi-annual", it adds 82 to the start date; if it is "Quarterly", it adds 45 to the start date; and so on, there about 20m different frequencies. After it adds the above value to the start date, I need to check if that number is less than today's date (the day I run the code). If it is, it needs to flagged as "LATE" and the whole row of info copied to another worksheet with LATE as the title and all the column headings and info copied to the worksheet. I hope this makes sense to someone because I am a beginner in Excel and even less informed when it comes to VBA. Any help would be greatly appreciated.
The way the process must work is that I need to check the frequency and if it is "Weekly" or "Monthly" , it is ignored and goes on to the next row. All other frequencies are cut in half, i.e., "Annual" is 183 days, "Semi-annual is 92 days", "Quarterly" is 45 days, "2-Year" is 365 days, and so on. This number needs to added to the scheduled start date (now formatted as a number, not a date, and checked to see if it is smaller than today's date (also a number). If it is, it is reported on the second worksheet (titled Late).
creating the user form using the submit button. Ive used a tutorial to create the form and the code, but it doesnt work i get a subscript out of range error 9)
Here is what i have
Private Sub addpatient_Click()
Dim RowCount As Long Dim ctl As Control ' Check user input If Me.txtfirstname.Value = "" Then MsgBox "Please enter a First Name.", vbExclamation, "Patients " Me.txtfirstname.SetFocus.........
I have 2 worksheets (worksheet 2 is Slicing and Worksheet 1 is Production).
Production worksheet D6 has a dropdown box for, 1, 2, 3, 4, 5, 6, 7, 1.1, 2.2, 3.3, 4.4, 5.5, 6.6 and 7.7.
In the Production worksheet, I have in cell E6 =IF(D6=1,"ONE",IF(D6=2,"TWO",IF(D6=3,"THREE",IF(D6=4,"FOUR",IF(D6=5,"FIVE",IF(D6=6,"SIX",IF(D6=7,"SEVEN")))))))
In the Production worksheet, I have in cell F6 =IF(D6=1.1,"ONE",IF(D6=2.2,"TWO",IF(D6=3.3,"THREE",IF(D6=4.4,"FOUR",IF(D6=5.5,"FIVE",IF(D6=6.6,"SIX",IF(D6=7.7,"SEVEN")))))))
How do I show in Slicing worksheet cell B6, either 'ONE', 'TWO', 'THREE', 'FOUR', 'FIVE', 'SIX', 'SEVEN' as i have the formula =PRODUCTION!E6&PRODUCTION!F6 and the cell shows '
I need to enter a countif formula if a cell equals the name of the active worksheet and also cell A1. My worksheets are not always the same and I also want to be able to copy this formula to multiple worksheets so if the formula states active worksheet then is should work properly when I past it to multiple tabs (at least in my head)
Depending on the text entered into one cell, I'd like another cell to state n/a. For example, if cell a2 shows the text of cash, then cell b2 would show n/a.
I have a spreadsheet that is used for sales territories. In column A, I have customer names, in column B, I have the State abbrev., In column C I would like to return as salesperson's name based on the State.
Aco IL John Smith ABco OH Jane Doe Cco WI John Smith Czco IL John Smith Dco WY Adam Scott Fco UT Adam Scott FDco CT Bill Jones etc WI John Smith
So I need a formula to enter in column C, that will return the correct salesperson based on the state in column B. (when auto filled down)
For example: IL,WI,MN,IA,ND,SD = John Smith OH,PA,KY,MI, = Jane Doe etc
The jist of the problem is that employees are paid their normal wage up untill 37.5 hours of work. From 37.5 to 40 hours of work they are paid 1.5 times their wage. Any hours over 40 are paid at 2 times the regular wage.
So i need a formula that can work out their total pay. Im not sure what i could put in a dummy document to help you since it would just be one cell for their hourly wage, one for their hours worked and then one for the calculation. so you can reference any cell as an example and assume £6 as hourly rate
Working on automating a data update process for my department (well, for the Italian speaking analysts anyway). I'm trying to import data from an embedded PDF to my Excel 2007 worksheet - I only need the data on the PDF, but if the whole screen can be scrapped I can clean it up in my code.
My "Drawing" is embedded on Sheet1, later on in Sheet12 I click a button that'll send an automatic email to a user. I want to attach the embedded PDF onto this email if it is at all possible??
Code: Dim Drawing As Object After I've declared my variables I've tried setting the variable "Drawing" to the object, this is where I'm encountering my errors mainly "Type Mismatch" or Object Variable not set...
Code: Sheets("Menu").Visible = True Drawing = Sheet1.Shapes.range(Array("Drawing")) Selection.Verb Verb:=xlPrimary Sheets("Menu").Visible = False At the bottom of the code, this is where i pull in the object
I need to create a formula that will calculate a total if someone checks a certain box. (Each check box is associated with a cost. When people check the correct costs, the bottom should total the costs checked.)
I have a worksheet with Labels (from the "Control" Toolbox) embedded and I want to read and/or set the BackColor value in VBA. I can't figure out how to accomplish this when they're embedded on a sheet like this.
I have a worksheets (named Graphs) that contains 12 pie charts, 8 column charts and 4 line charts. I would like to create some VBA code to loop through all these 24 embedded charts and modify only the pie charts. I'm OK with the code to do the modification (which is to set their plot area size and also to delete the title), however, I have no idea how to do the initial loop to select only the pie charts. I'm sure there's a much better way then hardcoding in each of their chart names.
I'm using Excel 2003 and have a spreadsheet that I want to distribute to a handful of people around the globe.
I want some cells in the page to link to various PDF files which I need to distribute with the worksheet.
I can embed the PDF files no problem, but I need each link to the embedded objects to take up no more vertical space than one row of text (without an Icon) - ie I need to be able to access the object through a "hyperlink style" item.
I can't figure out how to do this, as the hyperlink function does not seem to permit linking to embedded objects.
Our state carries a 4% sales tax on all items except food and prescriptions. Our county carries a 3% sales tax on everything.
Attached on my work sheet: Column "C" determines if an item is either food or non-food. "G5" is the subtotal of column G "G4" is the S/tx on "G5" at 3% "G3" is the S/tx on "G5" at 4%. "G2" is the gross pay out.
My question is: I'd like a formula for Cells "G3" and "G4" that can determine which items paid for in column "G" match a "N" or an "NF" in column "C".
If an item in column "G" represents a "F" in column "C", then there should not be anything in cell "G4" If an item in column "G" represents a "NF" in column "C", then there should be a figure in "G3" & "G4".
to automate a process that split name, address, city, state, and zip.
here are the examples of name, address, city, state, zip that i would like to be split in each column. this is difficult because the datas are not consistent and not predictable in how it WILL BE GIVEN....
I believe many people face is to automate a process that split name, address, city, state, and zip.
here are the examples of name, address, city, state, zip that i would like to be split in each column. this is difficult because the datas are not consistent and not predictable in how it WILL BE GIVEN....
I am looking to create a macro button which will reset the sheet to its original state.
I have locked the cells users should not imput data into, and unlocked where they add their data.
At the end of every school year, they will need to be able to reset ALL the workbooks back to their original state with all the reference formulas.
I am thinking I will need to tell the macro to create a hidden copy of the workbooks and then upon hitting reset it will use the backup to override the current. But they will need to be able to reset at the end of every year.
I would like to have one reset button that resets ALL the workbooks at once, but if not, I could put a reset button on each workbook.
As I have just started my VBA training, I have a code that will create a backup and hide it, but I have no idea how to do the reset portion. And again, since they need to be able to reset it each year for x amount of times, I don't know how to get it to keep having a fresh backup and get everything to its original.