Thank you a billion times over.
This solves the problem. I had no idea that goto commands even existed any more (last time I used one of these was on my commodore 64, back when we had to have a number for every line of code!).
The If Not.... Is Nothing Then command was also key to fix the problem.
Cheers!
User Profile
Collapse
-
Actually, selecting "No" works just the way I want it to, it finds the next entry and adds the info from the row info to the form and then prompts the user with a "Yes/No/Cancel" question asking if it's the right client. This only loops for as long as the user chooses for it to loop.
I know my programming isn't as clean as it could be, however this program only appears to break down if the name I enter (which becomes...Leave a comment:
-
Okay, I've made it work much better, but now if the item I'm looking for is not in my search request, the program stops working. Here is the new abbreviated code:
[CODE=vb]LookFor = InputBox("what is the client name?", "Search")
If LookFor = "" Then
End
End If
Cells.Find(What :=LookFor, After:=ActiveCe ll, LookIn:=xlFormu las, LookAt _
:=xlPart,...Leave a comment:
-
VBA - Excel FindNext Input box
Hi there,
I'm trying to set up a "find / next / replace" input box, but I have no clue how to make vb do this. Currently my code has a three step process. I have an input box that asks for a variable to find. Then when it's found, it puts it all the information on a given row into a spreadsheet. This would work just fine if there was only one row with the requested info. This is the code I have for the find function:... -
Thank you Killer. I will stick to your advice on that last one. It will probably make the code much simpler to understand in then end. I'll try out delaring at the form level when I truely come to the need. Cheers!Leave a comment:
-
That was a HUGE help in my understanding of how to work out this little problem as I've been having major conceptual difficulties on this matter of passing information from one sub / function to another (I'm new to programming as well, can you tell?).
I did figure out how to pass the x variable to Ans and it returned my original favourite number. I appreciate your guidance.
I didn't understand how to declare x @ the...Leave a comment:
-
Okay, I've modified the code a bit, changed the subs to functions and cleaned it up a little, but it's still not passing the original variable x. This program should ask for your favourite number in Ask, then it should add 10 to that number in the main Sub and show the new number, then it should show you your original favourite numberin Ans. If I put in 100 as my favourite number x in Ask, I should get 110 as the modified number in Sub, and then...Leave a comment:
-
Passing values from one sub to the next
Hey there, I'm new to VB and I'm having difficulty transferring a variable from one sub to the next. All I want to do here is ask for a variable (in this case, value is x) from a sub (subAsk), use it in my main sub (which manipulates it) and then reproduce the original value in a third sub (subAns). It only half works, and I've been all over the place looking for answers.
Below is the code for what I'm trying to do (I'm in VBA for...
No activity results to display
Show More
Leave a comment: