My question is about passing arguments to UserForm procedures. I've created a Main procedure. Main calls a sub procedure and returns an array. Obviously Main can now use the array. But then Main calls a sub procedure to open my userform.
All of my userform sub procedures need to use the array I created in Main. Do I have to pass the array into all of my userform procedures? Into the UserForm_Show procedure? And then again into UserForm_Initialize? And then again into ComboBox_Change? I don't understand how to give my UserForm procedures the array from my Main procedure.
I have been trying to use a multi-select listbox as the argument for a subroutine. For some reason, I keep getting a run time error, type mismatch. I'm baffled because when I define the specific listbox, it works fine, but when I attempt to pass the listbox I get an error.
Public Sub OtherDirectTotal(Expense As ComboBox, CostCat As ComboBox, _ Cost As TextBox, Years As Msforms.listbox) Dim IDC As Double Dim IDCt As Double IDC = Val(UserForm2.txtIDC) / 100 If Years.Selected(0) = True Then If Expense = "Sponsored" Then If UserForm2.ChkODC = False Then Select Case CostCat......................
I want to display a string to users. Normally I would do that using message boxes. But that would not give me enough control over the font size, and I want to display using font size 48.
I could have used global variables, but that is not a good coding way. The other way of doing that is using property procedures. I could pass a string variable to a Label control on the form and then could format it.
I want to create a modalless userform with a textbox on it. While running, if user select a range on the active worksheet, the textbox will display selection address (example $A:$B,$A1:$C2...). Now I can do this with Application SheetSelectionChange Event. But I dont know how to make my userform like a Function Arguments dialog.
I have a workbook with no data sheets showing with all actions being taken by the use of Userforms.
To make the workbook look consistent I would like to use a Userform rather than the standard MsgBox, the problem I cant seem to work around is passing the result of a Command Button back to the original proceedure.
I am trying to work along the lines of this but I am not sure where I am going wrong.
This procedure would call the Userform and then provide the next action dependant on the users choice:
Public Sub Testing() Call TestMe If Ans = Yes Then Sheets("Sheet1").Range("A1").Value = "Yes" Exit Sub End If If Ans = No Then Sheets("Sheet1").Range("A1").Value = "No" Exit Sub End If If Ans = Cancel Then........................
Have a bit of code to list all procedures in project to a sheet. Idea from Chip Pearson, adapted with help from Norie. List procedures in module/project Reference is set to MS VBA Extensibility. Thought solved, but trying to use now only lists one procedure in the project Namely the procedure in the module identified here :
Set VBCodeMod = ThisWorkbook.VBProject.VBComponents("mdl_comp_pl_ProcedureList").CodeModule
I tried many variations by stopping at
Set VBCodeMod = ThisWorkbook.VBProject
But receive error message
Objest doesn't support property
Sub raw_pl_ProcedureList() 'Uses reference to Microsoft VBA extensibility Dim VBCodeMod As CodeModule Dim StartLine As Long Dim Msg As String Dim ProcName As String Dim wbBook As Workbook Dim wsList As Worksheet Dim rngProcedure As Range Dim intCounter As Integer intCounter = 1 With Application .DisplayAlerts = False .Calculation = xlCalculationManual . ScreenUpdating = False.........................
I received a suspicious email from <Excel Help/VBA Help: [firstname.lastname@example.org]>. It may be nothing but I am wanting to inquiry about it's origin and content, how would I do this? I of course have received other emails from this site.
I have a problem with the overreaction of my VBA function procedures. Basically, I have an input section with 1000 rows and 10 columns and an output section with 1000 rows and 40 columns. Each cell in the output section is with fomula:
I am trying to determine if it's possible to control the order of like events. In other words, if I have set up two Worksheet_Change events, can I control which one fires first? Or, as a second best, can I determine which one will fire first?
I am using Office XP on Windows XP, but I'm looking for a generic solution if possible.
If I'm starting in Sub #1 and I have turned screenupdating off, then later in the procedure I call a function that also has screenupdating off (and also back on at the end of the function), will I get a slight flicker here? I'm noticing a slight one, and I can only imagine that it's where the screenupdating is being triggered again. (removing the updating from the function isn't an option, because another procedure calls the same function & needs it turned off)
how is the best method to link up forms to "talk" to my modules? (aka set variables inside my module script)
the way i understand it with my C++ background, it seems like separate forms and modules act much like private declarations do inside class calls.
I know that in C++ i can declare a friend class to grant access to communication between classes... and i'm wondering if such a procedure is possible in VBA as well...
or to break it down for those not familiar with C++, quite simply, is there a method of code i can implement to have different user forms and modules to talk to eachother? as it seems that any variable declaration is all inclusive to that one object.
The only way i can think of passing variables is by having my code create a worksheet, paste variables one by one into cells, bounce to the destination module, and import those declarations one by one through the cell contents, and remove the sheet after use...
I know i can do it that way, but i really dont want to as that is pretty darn sloppy, and a mickey mouse way to tie my program together.
I am trying to figure out a method for calling the ith number in an array that was defined in another function. The mean function is working and the result is (1 x variables) array. Then, I want to use that array in the sdev function. I am having trouble pulling the ith number from the mean function. Also, is there a way to make variables constant so that they do not need to be declared for every function.
Sub stats() periods = Range("periods") variables = Range("variables") Redim X(periods, variables) As Double Redim uX(variables) As Double Redim sdX(variables) As Double 'Load Data For i = 1 To variables For t = 1 To periods X(t, i) = Cells(4 + t, 2 + i) Next Next 'Calculate Mean (run 'mean' function') uX() = mean(X)................................
I have a userform with a combobox in it that's rowsource is a column of company names in a worksheet. When a company name is chosen, a combobox change private sub runs and many userform textboxes are populated with information about the company that was chosen from the combobox dropdown. This information is stored on a worksheet. I then want to edit any of the information in these textboxes. Once my edits are made I have a CommandButton that is pressed to save the edit changes. This CommandButton runs a private sub that disables the combobox (thinking this would prevent the combobox private sub from running), deletes the row that the information originated from, and then SHOULD make a new row of values based on the contents of the textboxes following the edits. The problem is that the CommandButton coding that deletes the row causes the combobox change private sub to run because the company that had been selected is now the missing from the rowsource; this causes an error.
I am trying to make changes to the Y column where the calculation now looks at column C to see what is entered in that column. If it is "Futures" then it runs the existing formulas but if it equals "Forex" I want it to use the value in column D as the multiplier, where the Futures option uses the hlookup to get the correct multiplier from the Variables sheet. If column C is either "Options" or "Stock_ETF" then i want to just subtract column I from column Y times column P.
I attempted to add additional IF AND functions but got the error message "Too many arguments", so now i am not sure where to go from here.