Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
G'day there One and All,
I'm still plugging away at my application, but have hit another hurdle. I'm sure that there's a way around it, but I can't find one that won't require a huge rewrite of code while still providing the functions that I've got so far (although that might still be necessary) I have a userform with a multipage control. Each tab relates to a different range, and has similar controls on it - a listbox, a textbox, and "Add" & "Remove" command buttons. The data from the ranges is used elsewhere as .rowsources for comboboxes. The user can then select from their own lists that they previously used these multipage tabs to enter. There are only 3 pages at present - Holidays, Sections, Ranks, but there might be more later after I discuss further requirements. (Why is it that you can't be given a set of UNCHANGING criteria to work with? <g). Anyhoooo... I'm using a "Set" statement on selection of multipage tab: Select Case Me.MultiPage1.Value Case Is = 0 ' Defaults Me.cmbSave.Visible = True Me.cmbCancel.Left = 270 Case Is = 1 ' Location Me.cmbSave.Visible = False Me.cmbCancel.Left = (Me.Width / 2) - Me.cmbCancel.Width / 2 Case Is = 2 ' Ranks Me.cmbSave.Visible = False Me.cmbCancel.Left = (Me.Width / 2) - Me.cmbCancel.Width / 2 Set gRng = dSht.Range("wrkRanks") Call modFormSet.setFrmLst(Me.lbRanks, gRng) Case Is = 3 ' Sections Me.cmbSave.Visible = False Me.cmbCancel.Left = (Me.Width / 2) - Me.cmbCancel.Width / 2 Set gRng = dSht.Range("wrkSections") Call modFormSet.setFrmLst(Me.lbSections, gRng) Case Is = 4 ' Holidays Me.cmbSave.Visible = False Set gRng = dSht.Range("wrkHolidays") Call modFormSet.setFrmLst(Me.lbHols, gRng) End Select I then use the listbox and range details in various reuseable Subs in a general code module. Eg: Sub lstRemBtn(lb As MSForms.ListBox, rng As Range) brilliantly imaginative code goes here End Sub This Sub deletes 1 and only 1 entry from my range and updates the Listbox to reflect this. The problem is that it can eventually remove all entries from the list, and the next time the tab is selected an error arrises because there's no range to select. I should point out that these "wrkWhatever" ranges are dynamic named ranges. Also, the listbox entries are entered via an array with .rowsource set to "". This is because I also have "MoveUp" & "MoveDown" buttons (from one of John Walkenbach's books), to allow my users to set their own order for the range entries, and hence the later combobox selections or cell entry validation. The easiest way I thought of is to make the last range entry undeletable. I.e. range("wrkWhatever").rows.count can never be < 1, but the methods I've tried don't work. Once the range is "Set", and passed to my Sub, the exposed properties don't change so gRng.Rows.Count always gives the number of rows at the time of initialization. The same with ListBox.ListCount. Is there a way to update these properties once initialised? Or can anybody see some other way around this issue? I'll take any advice I can get. (Make that "polite" advice <g). See ya, Thanks for listening -- Ken McLennan Qld, Australia |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
why do i "sometimes" need to "edit chart object" before "source da | Charts and Charting in Excel | |||
Excel 2007: "Reference is not valid" when refreshing pivot table | Excel Discussion (Misc queries) | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
Scroll Bar missing "Control" tab in "Format Properties" dialog box | Excel Discussion (Misc queries) | |||
"Problems obtaining data" error refreshing Excel pivottable | Excel Programming |