I have a master spreadsheet that contains 3 different tabs (A, B & C) for 5 countries (UK, USA, IRE, JAP & ARG) - so 15 tabs in total.
Every month, I need to create 5 separate spreadsheets from this master spreadsheet - one for each country. Each separate spreadsheet must contain tabs A, B & C for each country.
I have written a macro that performs this perfectly, but I now need to be able to chose which of the tabs (A, B & C) are included in the separate spreadsheets - as they will not all be needed every month (some months I might only need tabs A and B by country, other months - just C, other months - all three)
I would like to include a form containing a tick-box list so the user can tick which of the tabs A, B & C are copied each month.
I have sheets named exactly the same as the entries of a listbox. Now I want excel to copy the value located in e35 in the worksheet previously chosen.
I tried th efollowing, but this doesn't seem to work. I simply recorded a macro doing what I wanted it to do (orange) but replaced the reference to the sheet with what I thought would be the choice the user made (green)
I am setting up a macro where the user opens their chosen file & their chosen worksheet which gets renamed & entered into my workbook. I can get them to open a workbook but I am having problems with the user being able to choose a worksheet and copy it over.
I have different excel files in a specific folder. All the files have only two sheets with same kind of data, formatting etc. Now I want to merge selective files on need basis (only the first sheet data) into a new different worksheet in which I will be running the code. Provide me a macro which will ask me to select the files I want to merge. Also the data range of the files ( needs to be merged) will vary time to time, so the macro needs to take care of that as well.
I would like to be able to array (group) all the sheets in my workbook that are listed in a Multi Select ListBox on a userform. To be exact I would like to select the required sheets I want from listbox 1, add them too listbox 2, then array (group) all the sheets in listbox2. The code to add items from list 1 to 2 is below, but I am unsure of the code to then group the sheets in list 2
Private Sub CommandButton2_Click() Dim iloop As Integer
For iloop = 1 To ListBox1.ListCount If ListBox1.Selected(iloop - 1) = True Then ListBox2.AddItem iloop
I am wanting to be able to change the data in a spreadsheet cell(s) using a visual basic form. I've attached my spreadsheet file, so that you get a better idea of what I'm trying to do. What I want to be able to do is, on the VB form, to be able to click on the list box to choose a client, then choose the module number (option box) next to it which will then show the client's marks for that module in the textboxes at the bottom of the form. Then to be able to change the marks that student has for that module. I've given it a lot of thought, but I'm really stuck at this moment in time.
I am trying to create a form where a user can click a button and add a document to a workbook. The file(s) can be hidden on a seperate sheet, but ultimately should be displayed in a List Box or Combo Box. Not sure which would be better in this case. Selecting the item from the list would open the document (either through a double click functionality or a seperate button). I have the beginning of the code below.
Private Sub AddFile_Click() Dim vFile As Variant vFile = Application. GetOpenFilename("All Files,*.*", Title:=" Find file to insert") If LCase(vFile) = "false" Then Exit Sub Sheets("RefrenceSheet"). OLEObjects.Add Filename:=vFile, Link:=False, DisplayAsIcon:=False, IconLabel:=vFile End Sub
I have a list of country names in a listbox that are populated using another worksheet that has these country names. When I make a selection in the listbox, I want the same country names to be highlighted in the worksheet. I will then be able to run a macro that takes those selected cells as input.
I want to do is to use a listbox userform control to navigate between sheets. Each listbox item is the name of a location, which can be dynamically created/added (by other means). Clicking the listbox item activates the corresponding sheet.
however, depending on the user-mode of the application, if the user navigates to another location, then they must return to the location from which they navigated. here's an example to make it clearer
0) user form initializes, populates Listbox = ( Loc1, Loc2, **Loc3** ) {asterix means 'selected/highlighted'}
1) user clicks 'Loc1': sheet for loc1 is activated; repopulate Listbox= (Loc3) {as must go back to from where user came}
2) user clicks 'Loc3' to return to last location: sheet for loc3 is activated; repopulate Listbox = (Loc1, Loc2, **Loc3**)
i have gotten it all working fine, except that for some reason in Step #2 (the return to initial sheet & items) neither.......
I use the code below to enter a value from a list box in a cell on a workssheet. Is it possible to code VBA to enter a number for the position of the selection in the listbox to a cell in a worksheet rather that the actual value from the list box. For example if my list is:
Option1 Option2 Option3
And I click on Option2 in the list, I can sennd the value 2 to a cell on the worksheet rather that the value "Option2' from the list.
Private Sub ListBox1_Click() Sheets("SA").Range("SA_Poistion_To_Archive_A_New").Value = ListBox1 End Sub
I am trying to create a data entry form with a text field and a listbox. The list box is populated by another sheet and the text box will be used to enter names. I need to be able to enter a new name, select multiple options from the list box and then click a button to add this info to a sheet in excel.
I have read about changing the list options to allow this etc - the problem is I can't get the results to go back into excel - all I get is a name with nothing from the listbox.
I want to select items in a listbox and transfer those items via command button in a textbox. The listbox is already filled. I have no idea how to realize that.
Attached is the form I created so far. I copied everything together and matched it up for me. It's probably not the best way but it works. I marked the section where I need help in yellow.
I am hoping to create a drop down list of months in one sheet, and when I select a certain month, columns in about 10 other worksheets in the same workbook will either hide or unhide columns...
The spreadsheet is laid out with columns (C-N) for each month in the year, for actuals, then columns for budget and budget variance (O-P), then YTD Actual, YTD Budget and YTD Variance. When I select September, for example, I want October-December to hide, and leave Jan-Sep unhidden, while keeping the budget, YTD and variance columns.
I've created drop down box using VBA code. Data for drop down box is on the Sheet2 and drop down box created on Sheet1. Need code I have to use to copy selected value from box to any cell on Sheet1 (i.e. Sheet1.A5). Here is my
Private Sub Workbook_Open() CreateMyBox End Sub
Sub CreateMyBox() Dim MyBox As Excel.Shape With ActiveSheet Set MyBox = .Shapes.AddFormControl(xlDropDown, 5, 17, 175, 15) End With With MyBox .Name = "MyBox" .Fill.ForeColor.RGB = RGB(255, 0, 0)..................
I am trying to copy rows from sheet1, In which the column A is a date column. When the sheet2 is selected I want an input box to pop up and take 2 dates as input. All the rows between those 2 dates should be copied in sheet2.
I am using the following code to copy all rows that have a cell with a background color to another worksheet. In my first workbook this works just fine. In my new workbook, however; it is not working correctly. There are 111 rows that have a cell with a background color (all the same color). When I run the macro it is only copying the last row that has a colored cell. I have been trying to figure out the reason for the last 3 hours and I give up.
Sub CopyColor2() Dim rReply As Range, rCell As Range Dim lCol As Long
Set rReply = Application.InputBox _ (Prompt:="Selct a single cell that has the background color you wish to copy", Type:=8)
I have two tables "Table A" and "Table B" with records in rows (typically). On one Worksheet I have a report with 10 empty "slots" ("Slots A") waiting records from Table A, and 10 empty slots ("Slots B") waiting Records from Table B. In those slots, fields are arranged one below another.
PROBLEM 1. I need to find a way how to automatically copy chosen records from table A to slots A, and from table B to slots B. There is no rule how many records, and which records are to be copied. Some slots can stay empty.
PROBLEM 2. Slot B has the same number of fields as the Table B, plus one more field, let's call it "extra cell". In the "Extra cell" goes a result of a function, which arguments come form that Slot B, but from ONE Slot A as well. So, I need to "link" every Slot A with one or more "Slot B"s.
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.
What I'm trying to do is print only the selected worksheets from a listbox. I have created a UserForm and a ListBox which displays all unhidden worksheets in a workbook. The ListBox MultiSelect control is set to 1-fmMultiSelectMulti. I would like to be able to click CommandButton1 and send the selected worksheets to print, but going to Print Preview first. This is what I have so far:
Private Sub UserForm_Initialize() 'Displays only visible (non-hidden) worksheets in listbox2 Dim ws As Worksheet For Each ws In ThisWorkbook.Worksheets
[Code]....
how I can modify this code to print just the selected worksheets?
To this point I have been able to successfully write code that will save a constant set of worksheets as a pdf. However, I would now like to alter it to be able to dynamically select the desired worksheets from a list box (I have been able to populate my list box) and then save as a pdf. The last step is where I am have issues. This is what I have thus far..
Dim relativePath As String Dim Selected As Long
For Selected = 0 To ListBox1.ListCount - 1 If ListBox1.Selected(Selected) = True Then Sheets("Summary").Range("Q65536").End(xlUp)(2, 1) = ListBox1.List(Selected) ListBox1.Selected(Selected) = False
So I am supposed to take the names of worksheets and populate a listbox with them, simple enough as I had it running, but now it isn't working. Here is my code:
Code: Private Sub UserForm1_Initialize() Dim ws As Worksheet i = 1 For Each ws In Worksheets Worksheets.Select Sheets(i).Activate ListBox.AddItem (ActiveSheet.Name) i = i + 1 Next ws
[Code] .......
Why it isn't populating the listbox anymore? There arent any errors just a blank box.
Let's say I have a workbook with 7 worksheets named, for example, "Instruction", "Begin", "Worksheet 1", "Worksheet 2", "Worksheet 3", "End", and "Data". (in that order)
What I want to do is run a macro to go to whatever worksheet that is in between "Begin" and "End" and copy, for example, cells $C$1:$D$10; then paste as formula into worksheet "Data" starting from cell C1 and then down a list (i.e., copied cells from "Worksheet 1" get pasted as formula into "Data" cells C1:D10; then copied cells from "Worksheet 2" get pasted as formula into "Data" cells C11:D20, and so on and so forth).
But if I were to add more worksheets (e.g., "Recipe" and "ToDo") positioned in between "Begin" and "End" and run the macro again, it'll either 1) re-copy all the formulas from the included worksheets back into "Data" including the formulas from the newly added/placed worksheets or 2) it'll add the formulas from the newly added/placed worksheets and paste into "Data" at the end of the list.
Can create the macro to run based on the position of worksheet, and not based on the name of worksheet, since ultimately there will probably be over 10 worksheets between "Begin" and "End".
How do I modify the following code to copy the whole row of data in the listbox and not just the data from the 1st column. My listbox has 4 columns in it:
Here's the Private Sub CommandButton2_Click() Range("TEST!A1").End(xlUp)(2, 1) = ListBox1.Value End Sub
I have a saved file at d: named Report.xls from another file I am copying column and pasting data to this report file, this is done by a macro. While pasting data to the report file, a pop up message is coming up – A file named D: eport.xls already exists in this location? Do you want to replace it?
In case “yes” is clicked it pastes the data But the problem is that the macro that I have in the report.xls vanishes. The macro I need in the report.xls?