Group Sheets Chosen From Listbox
Dec 8, 2006
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
End If
Next
End Sub
View 2 Replies
ADVERTISEMENT
Dec 16, 2007
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.
View 7 Replies
View Related
Jan 15, 2008
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
View 3 Replies
View Related
May 7, 2008
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.
View 4 Replies
View Related
Nov 6, 2006
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.
View 3 Replies
View Related
Mar 2, 2008
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.......
View 2 Replies
View Related
Feb 12, 2009
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)
Do While continue = vbYes
UserFormware.Show
Cells(16, 4) = UserFormware.ListBox1.Text
Cells(18, 4) = UserFormware.TextBox1.Value
Sheets("UserFormware.TextBox1.Value").Select
Range("E35").Select
Selection.Copy
Sheets("Calculator").Select
Range("E35").Select
Selection.Paste
If UserFormware.ListBox1.ListIndex = -1 Then
MsgBox "You must select an item"
End If
Unload UserFormware
continue = MsgBox("Do you want to add another warehouse?", 4)
Loop
View 9 Replies
View Related
Oct 5, 2007
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
View 2 Replies
View Related
Mar 18, 2008
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.
View 4 Replies
View Related
May 6, 2009
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.
View 9 Replies
View Related
Oct 29, 2006
I have a workbook containing over 75 sheets. I would like to print only a select few of those sheets using a macro. I did download the "sheets to print" workbook submitted by Dave Hawley ,and have tried (in vain) to adapt the code so that it does not display ALL of the workhseets in the userform box. I want to limit the sheets displayed in this box to onnly those that I name.
View 8 Replies
View Related
Feb 9, 2010
Sub ComboBox1_Chg()
For Each Sheet In Worksheets
If Sheet. Name <> "CoverPage" And Sheet.Name <> Sheets("CoverPage").ComboBox1 Then
Sheet.Visible = False
Else: Sheet.Visible = True
End If
Next Sheet
End Sub
It works if I step through it (F8) but the ComboBox doesn't work. It's named ComboBox1, and in the properties the ListFillRange shows all of the names in the list in the ComboBox correctly.
View 5 Replies
View Related
Jan 17, 2009
I wanted and the solution is on two sheet which I grouped, make copied and move into a new book. This is fine, but then I want my code to lock/protect all of my sheet in my program document, this can't be done with my current code because the sheets are group.
View 9 Replies
View Related
Feb 24, 2014
I would like to group some columns to all the sheets that I will have selected. Unfortunately the below code only apply the code to the sheet I am looking at.
Code:
Sub Group()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
With ws.Range("F:Q").Group
End With
Next ws
End Sub
View 3 Replies
View Related
Oct 5, 2006
I have a sheet that I protect but i use the below code so that I can still use my gouping '+' or '-' symbols to hide/unhide rows.
ws.Protect Password:="PASSWORD", userinterfaceonly:=True
ws.EnableOutlining = True
This is ok but When close the workbook and reopen it, my sheet becomes fully protected and i cant use the group icons. Can anyone either suggest better code or a way to initilise the workbook to act in this way when it loads up. For Reference Below is my full
Sub ProtectAll()
Dim ws As Worksheet
sSheet = Control.Name
For Each ws In ThisWorkbook.Worksheets
Select Case ws.Name
Case sSheet1
Case Else
ws.Protect Password:="PASSWORD", userinterfaceonly:=True
ws.EnableOutlining = True
End Select
Next ws
End Sub
View 2 Replies
View Related
Jun 4, 2009
I'm trying to do a search of 2 sheets and if the value of column "H" is True(in text) "Label57" is to be visible and "Label58" is to be hidden. And if the value is "False"(in text), "Label58" is to be visible and "Label57" is to be hidden. Hope this all makes sense.
The code below works fine for only one of the sheets(Orders) but not the other(ArchivedOrders).
With Sheets("Orders")
Set r = .Columns("A").Find(Me.ListBox2.Text, , , xlWhole)
If r Is Nothing Then
With Sheets("ArchivedOrders")
Set r = .Columns("A").Find(Me.ListBox2.Text, , , xlWhole)
If r.Offset(0, 7).Value = "True" Then
Label57.Visible = True
Else
Label57.Visible = False.................
View 9 Replies
View Related
Sep 22, 2009
I'm trying to create a userform that allows the user to swap sheets from visible to hidden status. I've made it to the point where all the sheet names are populated based on their current status in their respective listbox, but I am stuck on using the results of any swaps to newly set their visible property. the code I have in the userform is as follows:
View 2 Replies
View Related
Jan 24, 2014
Code:
Dim flag As Boolean
Private Sub UserForm_Initialize()
Dim myWorksheet As Worksheet
flag = True
[Code] ........
I made a user form that, with the click of an item in the listbox (which is populated with the worksheet names), will show or hide the matching worksheet. I was using indices, but a problem occurs when there are some hidden sheets to begin with, because the listbox is filled with only the visible worksheets (that's part of the functionality required) and so, when there are hidden worksheets the indices of the listbox are totally different. So, to avoid that kind of bugs I thought I'd use the sheet + listbox names to show/hide the worksheets, but that is proving to be a very hard task.
How I can use the listbox item names + worksheet names to make the "mapping" correctly?
View 5 Replies
View Related
Oct 16, 2007
I have 25 pages in a workbook/spreadsheet. On the front page I want to insert a macro button which when clicked, displays a message box presenting a list of pages in the workbook with tickboxes next to them - so the user can tick which pages he/she wants to print. I also want a 'select all' tickbox which when clicked - selects all the pages. However, I do not want a tickbox for all 25 pages in the workbook - only a selection of them. how to write this code so I can specify which pages will be displayed in the print tickbox screen that appears when the macro button is clicked?
View 2 Replies
View Related
Nov 17, 2007
I have a workbook with roughly 25 sheets, each sheet represents a customer. Each month, I want to be able to run a macro in the workbook that will produce a UserForm containing a Listbox of each unhidden customer (worksheet) in the workbook. After I select all of some of the customers, hit a "process" button which will run a macro on each of the selected customers from the UserForm one worksheet at a time.
I currently have code written to produce the UserForm and populate the list, but I am uncertain how to write the code for the "process" button to run the macro on each selected customers one at a time. All I know how to do is have excel select all the chosen customer worksheets all at once.
View 8 Replies
View Related
Jun 13, 2006
I have created a custom Menu (excel add-in) to make my work easy in excel. My problem is to print only selected sheets from Workbook in one PDF file, for that I've created a Userform with 2 listboxes, add sheet and print buttons. In the first listbox are listed all the sheets and in the second listbox are the sellected sheets to be printed. What I've succeded so far is to print selected sheets, but it creates one PDF file for each sheet, only if I put my code in workbook and not in Menu add-in (.xla file). As PDF Printer I use PDF reDirect Pro v2.
View 8 Replies
View Related
Oct 17, 2007
I am trying to go through each worksheet and if the worksheet name is Hematology then the header columns will be put into the listbox (ListBox1). The first row of the header is the parameter and the second is the units. Ideally I'd like column 1 to have the first headr row and column 2 to have the second header row. Once the listbox is completed, the user can select multiple columns by the header and those columns will be deleted. I have the ListStyle set to 1-fmListStyleOption and MultiSelect set to 1-fmMultiSelectMulti
The only thing I get when I run the rubroutine is a userform (Hematology), an empty listbox (ListBox1) and my two command buttons (Nothing to Delete and Remove Parameters).
Private Sub Hematology_initialize()
Dim Wrkst As Worksheet
Dim Header1 As Range
HeaderRange1 As String
For Each Wrkst In Worksheets
If Wrkst.Name = "Hematology" Then
For i = 1 To Wrkst.ColumnCount
Set Header1 = Wrkst.Cells(5, i)
HeaderRange1 = Header1.Address & ":" & Header1.Offset(1, LastColumn).Address
With Hematology.ListBox1
'Clear old ListBox RowSource
.RowSource = vbNullString
'Parse new one
.RowSource = HeaderRange
End With
Next i
End If
Next Wrkst
End Sub
View 9 Replies
View Related
Nov 26, 2008
Split off from Fill Multi Select ListBox With File Paths & Open Selected Files
if I can add a other request I just thought of.
If a sheet is also in one of the workbooks list, can I add a link directly to it?
For example, Workbook1 has a sheet named "MARCH".
When i'm working on sheet "MARCH" I want to be able to click on a button to see the Userform I created from the script above and see if the sheet "MARCH" is present from the other workbooks listed, if there is a sheet "MARCH" in the workbooks listed, I want another listbox to show what files contain sheet "MARCH" and link to them.
View 9 Replies
View Related
Mar 17, 2014
I am trying to write VBA code that groups cells between blank rows and inserts a message if a string of text (a name) is missing from the entire group. I want the code to search cells in column A and group the cells between blank cells. Use the name I input in an input box as the search criteria and insert a message in the Column C next to the last blank cell in the group and then move on to the next group and highlight the cell in red with bold text. I am including a spreadsheet with an example of what the sheet should look like before and after the code is run.
View 11 Replies
View Related
Nov 12, 2009
I have date fields as column labels in a pivot table. When I try to group them I'm only given the option to group by integers and not by months, years etc.
I've had a look at the format settings of the column and they are formatted as date fields.
View 9 Replies
View Related
Feb 10, 2014
I have several groups of data in the same sheet. Each group has two blank rows above the first row of data. Each group has column "B" in common (e.g., "Phone" in the example attached). I'd like to add a title/label of "Phone" to the first column in the row immediately preceding the first row of data for that group.
View 1 Replies
View Related
Jan 17, 2013
how to use the group box to group a number of option buttons together.
Question is, lets say, i have a total of 4 group box. if i want it to work in such a way where by once 2 option buttons are being selected (1 option selected from each group box), the rest of the option buttons in the 4 group box will be greyed out. is that possible?
View 2 Replies
View Related
Aug 9, 2006
My store uses a retail price "code" wherein a price like 99 in expressed as a
code like "PP"--exchanging the number digits 1-0 as letters.
Is there a function to do this automatically?
View 9 Replies
View Related
May 28, 2014
In Col X of the attachment, I have manually entered the count of the rows within each sub group, as determined by the counter in Col W. How can I do this automatically? I need this because when I filter the spread sheet by Rank, I need to know how many selections, of the filter Rank query, were in a sub group of ? number.
View 2 Replies
View Related
Apr 18, 2014
I have this massive spreadsheet, with the maximum rows excel will fit on one sheet. In the interest of simplicity, this is what the raw data looks like:
Last First Amount
Jones Jim $1000
Jung Joe $700
White Jon $100
Jones Jim $200
Jones Jan $300
Jung Joe $800
White Jon $200
What I want to do is automatically get excel to group all the same names together. Then I want it to sum all the values for each name, then order by largest total value for each person, then order that by name alphabetically. In other words, the above would look like this after the sort:
Last First Amount
Jung Joe $800
Jung Joe $700
Jones Jim $1000
Jones Jim $200
Jones Jan $300
White Jon $200
White Jon $100
Or, if necessary, there could be sum total rows under each name...although I don't have spare rows, so IDK. I could delete some rows if I had to, but would rather not.
View 1 Replies
View Related