How to call a function from an other function using vba [closed] - excel

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 4 years ago.
Improve this question
I am new to VBA and I try to populate a dropdown list when the page is loaded, I want to call a void function that popualte the ddl
example for my code:
Private Sub UserForm_Initialize()
FillddlList()
End Sub
Private Sub FillddlList()
ddlProducts.AddItem("car");
ddlProducts.AddItem("house");
ddlProducts.AddItem("dag");
End Sub
But it doesn't work... is it possible? what is the right way to do it?

It should be like this
You can use the optional keyword CALL if you use the Call keyword to
call a procedure that requires arguments, argumentlist must be
enclosed in parentheses.
you also don't need semicolons after adding items to your combobox.
Private Sub UserForm_Initialize()
[Call] FillddlList
End Sub
Private Sub FillddlList()
ddlProducts.AddItem ("car")
ddlProducts.AddItem ("house")
ddlProducts.AddItem ("dag")
End Sub

Related

Even when I have the return value, it still returns none? Python Code [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 months ago.
Improve this question
The goal of this code is to alphabetize and uppercase the inputted tuple of values. However, it is returning none when I run it. I find this odd since I have a return and I beilieve everything is in correct order. If you can help find the answer, thanks. Here is the code:
def sorter(*args):
args = " ".join(args)
uppercased = args.upper()
listed = list(uppercased)
sorted1 = listed.sort()
return sorted1
print(sorter('happy', 'apple', 'zain', 'freindly', 'jakob'))
Run your code in the Python Tutor Visualizer and step through it line by line, and you will see that listed.sort() doesn't return anything but instead mutates listed:
Before executing listed.sort():
After executing listed.sort():
The docs for list.sort also tell you that the list is sorted in-place, and the function signature doesn't have a return value.
The solution is therefore to use listed after sorting it, instead of creating a new variable sorted1.
(Note that there are other logical mistakes in your code which will prevent it from delivering the result you probably expected, even after this specific issue is fixed, but that's beyond the scope of this question and answer.)

How to loop through an array of objects using *ngFor [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 9 months ago.
This post was edited and submitted for review 3 months ago and failed to reopen the post:
Original close reason(s) were not resolved
Improve this question
I want to loop through an array of objects using *ngFor
For more explanation see below :
[
{sn: 'N300W150726', merchantName: ' test''}
{sn: 'N300W150726', merchantName: 'alex', }
{sn: 'N300W150726', merchantName: 'alexa',}
]
Once I want to pass clicked data due the function I got an error
my function shown below
<button nbButton (click)="getTpeByUser(item.sn)">
{{ item.merchantName}}
</button>
Do you see totally nothing? Then check toggle variable. Is the list not showing? Then check the nameUsersByType Array. BTW: the array elements are not separated by commas. Is this true? Then look there for your answer

How to replace occurances of a string with changing values in kotlin? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I have the current string "number number number number number" and I would like to replace it with "1 2 3 4 5". How do i replace occurrences of a string with incrementing numbers in Kotlin?
Your idea of a solution in the comment is in the right direction.
The way to do this using a single call to the standard library is this:
var i = 1
val result = text.replace("number".toRegex()) { _ -> "${i++}" }
(runnable sample)
This replace overload accepts a function that is called on each MatchResult (which is ignored in this case)

Calling VBA Functions with parentheses and named arguments [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
I can call a vba function without parenthesis and use named arguments:
Workbooks.Open Filename:=file, local:=True
When the call is supposed to return a value, VBAs documentation states: "To use the return value of a function, assign the function to a variable and enclose the arguments in parentheses, as shown in the following example." Link to docs
I can call the function with parentheses, like so:
Set opened_wb = Workbooks.Open(file, , , , , , , , , , , , , True)
Is there a way to utilize named arguments, when calling functions with parenthesis? I find it unreadable to call a function with 10 positional arguments, especialy it 8 of them are not used.
You've got the answer right on the link you provided, just below that line you mentioned. You can indeed call them like this:
Set opened_wb = Workbooks.Open(Filename:=file, local:=True)

Compile Error: Invalid Error Procedure [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I am using Excel 2013 and I put the following code into Sheet5 Code box and i try to compile it and get a Compile Error: Invalid Error Procedure
Worksheets("Sheet5").Range("C3").Value = Worksheets("Sheets1").Range("G3")
Are you sure your sheets are spelled properly ? One is named "Sheet5" and the other "Sheets1". Notice that one has an extra "s". Also I'd say that you should be consistent. If you use an explicit call to the "Value" property then do it on both sides. Note that you can omit it on both sides.
I'm guessing that you pasted the line of code into the worksheet module by itself and that the compile error you get is actually "Invalid Outside Procedure." If so, you need to put the code into a function or subroutine, something like:
Sub Test
Worksheets("Sheet5").Range("C3").Value = Worksheets("Sheets1").Range("G3")
End Sub
Then you'll get a "Subscript Out of Range" error because you don't have sheets with those names, which will be progress :).

Resources