Copy Named Range Chosen From Drop-Down & Paste To Last Row
Feb 21, 2009
I am a trainee dermatologist. We undertake allergy patch tests. There is a long list of different patch tests which are selected based on the patients history. I have put each of the types of patch testing on a master sheet. What I would like to be able to do is to have a control button next to each set, and when clicked would add that particular set to a "new patient" worksheet tab. And with every set having its own button, more than one set could be added to a new sheet. In the new patient worksheet id like the sets added with a single row gap between them.
I had tried, and managed to get a single series to work, but then it wouldnt allow me to add the next set, saying that sheet already exists. Ideally finally, id like there to be some way, or message to make sure after printing the new patient worksheet gets deleted.
I hope that all makes sense ! Even if I had a code for a single button that added to a master sheet at the next available row +1 I think I could manipulate the code to suit.
I'd like to know if it is possible to run a macro in a workbook that will open another workbook (of the users choice) extract data from it, such as columns from its sheets then paste that data into the workbook the macro is running from. The file to be opened will change, so i've found some code that enables the user to select the file to open then open it.
Dim strFile As String strFile = Application. GetOpenFilename If strFile <> "False" Then Workbooks.Open strFile
This brings up the standard windows choose file to open box, then opens the selected file. Am I correct in thinking that the Dim here will store the file name I select in the open file box? If so, I'd like to know how to select the workbook using the dim so I can manipulate it from the workbook I'm running the macro in. Incidentally, once the the data has been copied, I'd like the workbook opened with the macro to be closed.
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've attached a workbook which contains two sheets: PAYM DEVICE_PAYM
Data is updated on DEVICE_PAYM each day with the figures I need located in column "AN". I need to be able to copy the data from "AN" and paste it into a column on the PAYM sheet. The destination column on the PAYM sheet needs to be specified by inputting a specific date - ideally, I would like to use the calendar Add-In as part of this process. I've already input some code for the calendar but am unable to develop this further so that it finds the correct date column and pastes the data across from the other sheet.
I have read post re this question but have not been able to answer my problem. I get the error message 'Application defined or object defined error' when running the code below. I should indicate the range counter currently indicated about 6,200 rows that this code will work on and the individual range names in the list of 6,200 rows are spread over at least 20 worksheets.
The code appears to be running but after some time it stops on the line of code 'Range(Cells(i, 1).Value) = Cells(i, 2)'.
Sub PopulateWithImportData() Dim counter As Integer counter = Sheets("Imported Data").Range("Counter")
I've got a Combo Box that I want to be able to attribute Hyperlinks to. I would like to be able to select one of the options from the Combo Box and have the Hyperlink fire automatically. The conditions are:
Drop down lines with corresponding Hyperlink Named ranges: R FRONT R_FRONT_Hardwired L REAR Audio_1_AZ80 120V-60HZ 4A ER_16_PC_100A_Outlet_6 R REAR Audio_1_AZ80
I've attached the Code as text.It is not working and I'm sure there are a number of reasons why.
I am successfully opening a .csv file using a variable value stored in a named range in my Main file (the variable includes the directory and path). I copy data from the .csv file to the Main file then I need to close the .csv file without saving but I want to do that by using the
Windows("xxxx").Activate
command where "xxxx" is the namedrange in my Main file which stores the .csv filename (without the directory and path prefix).
I can use the
ActiveWindow.ActivatePrevious
command but if I have another workbook open, this one closes instead of the .csv file I opened from the macro.
I realise this is probably very basic and I've searched the forums but can't find any identical postings.
I purchased the Excel Hacks book, and when attempting to do hack #53 with a drop down list, I can not get it to work. I do exactly what the book says to do, however, my chart and my drop down list are not linked together, and when I change a name in the drop down list, the information on the chart does not change.
I have a dynamic named range which allows me to have an automatically growing drop down list in B1 as more cities are added in column A. however, my workbook will have N/A errors to begin with before cities are added.
is there a way for my drop down list in B1 not to include the N/A errors and only the cities? of course when the next N/A error turns into a city, i would like the B1 drop down list to recognise this and include it.
I'm trying to find out how I get a cell to automatically find a code based on the selection of a drop down menu. If drop down menu selction is Rent I want the cell to automatically find the code for rent 61100. It's a large selection that will grow alot bigger than it currently is so needs to also have growing room.? I can't seem to find any answers on here already that seem to work on this, (or understanding them is maybe my fault). I've attached the sheet
I have a workbook that contains budgets for as many as 50 divisions. I don't always know what the names of the divisions are going to be. I need a macro that will go through each worksheet and copy aa1:ao200 and paste it to a worksheet named "upload" in the next available row.
Here is something that i found here but i cant make it work.
Sub Macro4() ' Macro4 Macro For Each ws In ActiveWorkbook.Worksheets With ws Range("AA1:AO200").Select Selection.Copy If Application.WorksheetFunction.CountA("B:B") = 0 Then
I have tried to create a macro which prints the results of each heading in a drop down box. The listfill range is from B2 to B5 and the linked cell is B1. When manually recording the macro, i copy the heading from B2 into B1, the drop down list updates which in turn updates the cells which are linked to that, i then print out the page. The same happens when i copy-paste cells B3, B4, & B5 into B1. I then return finish the macro by copying B2 into B1.
But when i run the macro, the copy paste works but the drown down list doesnt update, therefore it doesnt update my linked cells so i acutally end up printing 5 indentical pages with the same info.
I need to create a function that by selecting a sheet name in a drop down box it will remove thinformation on the sheet from a consilidated sheet. The consolidation sheet is consolidating data from 30 sheets within the one worksheet
the attached spreadsheet is designed to record the number of days off workers have in a week. The drop down menu gives you choices to record the reason why a worker is absent but what I can’t do is total the number of days absent in a week as its words used to describe the absence and not numbers. If any one could assist me to total the days. I have attached an example which should explain the problem in a clearer manner.
Am trying to copy 50 worksheets from One workbook, into separate existing files (overwriting previous file) in existing folders; once copied, destination files can not be linked to source file.
I'm able to copy the tabs into new workbooks, in the correct folders, but when trying to perform PasteSpecial in new books, original source file is also pasted over.
The parts of the file name and folder location are cell values located on each sheet.
...
For Each sheet In ThisWorkbook.Worksheets sheet.Copy Set workbook = ActiveWorkbook With workbook.Sheets(1) .UsedRange.Copy .UsedRange.PasteSpecial xlPasteValues .Cells(1).Select Application.CutCopyMode = False End With
Been playing with this for some time and can't quite figure it out. I'm trying to copy a named range and paste special value to another named range of the same size. I recorded a Macro that does what I need, and I'll use if necessary, but thought I'd try to consolidate the code a bit and can't get it to work. The recorded macro is as follows:
Sub PasteRanges() Application.Goto Reference:="DataCopy30Yr" Selection.Copy Application.Goto Reference:="DataPaste30Yr" ActiveSheet.PasteSpecial Format:=3, Link:=1, DisplayAsIcon:=False, _ IconFileName:=False End Sub
My attempt to consolidate was this:
Sub PasteRanges() Range("DataCopy30Yr").Copy Destination: Range("DataPaste30Yr").PasteSpecial (xlPasteValues) End Sub
I get the Run-time error 1004 Copy method of Range class failed when I try to run this. Again, I can use the longer version with no problem, but in the interest of learning and since I have spent some time not being able to come up with the solution, I thought I'd ask the experts opinions before I gave up on it.
I am attempting to run a macro that will make conditional formatting I have applied permanent, and then remove the conditional formatting from the cell. My application for this is a master fantasy football cheatsheet, with multiple columns of the same player names ranked in different orders. When a player is drafted I type their name in cell A1, and conditional formatting is setup on so that name (presumably once in each column) will be highlighted/bolded/etc. For example, if I typed "LaDainian Tomlinson" in cell A1, I would be able to find his name in each list/column (from the conditional formatting that will make it stand out), and then run the macro to make this formatting permanent (show he has been drafted), and remove the conditional formatting code, leaving the effects. I found a macro online to do this at the following link, but am having some issues:
When I run the macro on any cells not containing conditional formatting, I get the message: "The formatting based on the conditions in the range (whatever is highlighted) has been made standard for those cells and the conditional formatting has been removed."
This messsage is precisely what I am trying to do, however, when I run the macro on a cell with conditional formatting (when it would actually be beneficial), I get "Run-time error '13' Type Mismatch"
When I go to debug, the error appears to be on the line
I have about 10 rows of data that have columns of information describing computer hardware and pricing. There are 10 rows, because each row represents a different country and different tax rates and pricing changes per country. So each column of a row has a specific formula to calculate information for that row's country information. All these 10 rows of formulas are kept as a reference at the bottom of the sheet.
At the top of the sheet I need to have a drop down menu to choose a country and then it will automatically copy and paste the row of that country to the current row at the top.
Is there any easy copy/paste macro for such a thing?
Basicly I used conditional formatting and lots of "IF".My solution lacks in style and it's time consuming ..
Long story short: I need to modify the way some cells are displayed based on the selection in a specific dropdown list.
I need that whenI select Task3 from the dropdown list next to "step1: please select" , everything from row 15 to row21 (both 15 & 21 rows included) and from row 23 on, to disappear.
I am attempting to populate a row of several cells on a worksheet using a drop-down list, using data from a seperate worksheet in the same workbook. The worksheet containing the data will be hidden (I do not think that matters in this case). Do I place a VLOOKUP function in the first worksheet cells? see attached sample
DropDownSample.xls
As a follow-up question, as time goes by, the data in the source worksheet will be appended with new items (additional rows of data). As each new item is added, will I need to edit the formulas, or is there a way for Excel to dynamically add the new data? This might be stretching my wish list a bit but I thought I'd ask.
I have a set of data on excel and would like to make searching for it easier.
I have created a drop down list in cell B4 (say, "Banana", "Apples" and "Orange"). Is there a way that if i select "Banana" in cell B4, excel will automatically go to cell A20 ?
I need method, using a button, that looks at a cell--say EO2, for example--, looks back on a master worksheet at a specified row and range for a match, then looks at the information from a specified range below the matching cell (The information in this column will either be blank or have an "X" in the cell), and then those rows that do not have an "X" will be hidden in the corresponding rows in the working worksheet. Therefore, if at any time the value in "EO2" ever changes, then it will automatically find a new match and repopulate and hide information as before. About 130 columns will have its own button so that a "query" can be made that depends on the information in a particular cell in that column.
The master worksheet now has matrix of 287 rows and 58 columns. Each row is for an operating procedure and each column shows a job code. An "X" in a coordinate cell for a column/row shows whether that job code is responsible for knowing that operating procedure. So, on the working sheet, an employee's primary job code is given underneath his or her name. When the button is pushed, all the operating procedures not required for a given person will be hidden and only the required ones will remain visible--grouped, if you will. Qualification dates will be easier to see now that the information is consolidated. Whenever someone transfers to a new position, a new code will be inputed on the working sheet. When the button is pushed, a new grouping will result. Any operating instructions that overlap will still have qualification dates, so that information will not need to be transcribed.
In my project I have two workbooks. I am working on getting one to pull data from another depending on which employee is selected from a drop down list.
TestLOG.xls contains a worksheet for each employee, with named sections within for various training the employee has, and down each row has information on the date this was received, initial, recurrent, etc. It is only this single worksheet for each employee that any data entry occurs, which makes things a lot more organized and efficient. TestFORMS.xls is the workbook accessed by the records department which has different worksheets depending on what data is to be presented. When an employees name is selected, I need the form to pull the specific data from another workbook, and post it on the current worksheet. This get repeated a couple times to fill the adjacent columns of data. I can't just select the whole table from the other workbook because in this current worksheet for example, only specific columns are pulled from the other workbook.
To better explain the flow... Current workbook is TestFORMS.xls Current sheet is Test Closed workbook is TestLOG.xls
In TestFORMS, sheet Test, when named cell Employee is selected with a value... Then open TestLOG in the background and open sheet of same name as Employee, and cope range ACtype. Back in TestFORMS, sheet Test, paste the ACtype data in the range named Type.
Private Sub Worksheet_Change(ByVal Target As Range) Dim Ename As String Ename = Range("Employee").Value If IsEmpty(Ename) Then Exit Sub Workbooks("TestLOG.xls").Sheets(Ename).Range("ACtype").Select Selection.Copy Workbooks("TestFORMS.xls").Sheets("Test").Activate Range("Type").PasteSpecial Paste:=xlPasteValues End Sub
Within the same sub, I would add additional lines of code to copy and paste the other ranges needed on the current worksheet. My current hangup is that I get an error at Range("ACtype") as that is not the proper way to call the range. There's more work to be done with the macro yet, like having it pull the data with TestLOG closed, which I believe is done by listing the path to filename. Then I need to maintain cell formatting on the new table when the data is posted to it. Hopefully the final task is to get this working so that when a new employee is selected in TestFORMS, the previous employees data is cut and the new posted, as the worksheet is just printed out for each employee and put on hardfile.
I am using Andy's scrolling chart, and it is working well. http://www.andypope.info/charts/Scrolling.htm. Is there a way to paste the data the chart is displaying into a new sheet? In VB I tried to copy the named range and paste it but it did not work.
I have a named range on one sheet, and I want to show this as a reference on other sheets. I thought this would be simple, but maybe it's just not the way named ranges are used.
Attached is a sample spreadsheet. First tab shows the table defined; in practice it would be much larger. Second tab shows how I want it to appear. I see that I can do this by copying each cell reference. But what would be nice is to simply say "Put the named range block of cells right here."
I have a named range within a sheet. It was pulled across when i performed a move/copy - create copy from another workbook. The name contains characters that cannot be displayed or recognised and so they are displayed as square symbols. This causes me an issue as i cannot delete the name. Even if i paste the list names, i cannot copy/paste the name as the characters are not recognised. I also tried using a macro to delete all names, which did delete all names, with the exception of this one. The VB code used was :
I have a number of named ranges on seperate sheets. As I add more entries to each sheet, the named range is naturally increasing so I dont have a fixed cell refence Effectively what I would like to know is - is there coding that would allow me to copy one named range - and paste the values to the the row beneath the last entry in a second named range. Filtering these I can do - it is just the copying that has me stumped