Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Button logic in Excel

Status
Not open for further replies.

nissan240zx

Programmer
Jun 26, 2005
280
US
Hello All,
I have about 20 fields in my excel, one of them is called Zip code
Need to do this is in excel. Have a button which will be a Yes/No thing.
Click the button, message box comes up and asks "Is this the correct zipcode?"
If the user clicks No , then ask to enter the new zip code, then followed by new marketplace.
This entered values need to be filled in the column next to the button.
After that ask if they want to enter more, if they click "More", then do the same enter new zipcode and marketplace. Each entry made needs to be dropped in a new field.
Continue till they hit "Cancel"

If they hit cancel or "Yes" they should come to the next row, but this time instead of clicking the button it should straight go to the message box that asks Yes/No.
Loop till end.

Let me know if I need to give an example or more information.

A good programmer is someone who looks both ways before crossing a one-way street. - Doug Linder
 


nissan240zx,

What is the purpose if placing a clunky interface between the user and the sheet?

You mentioned 20 fields, but then, only referred to two of them. What's going on with the other 18?

Have you looked at the Data/Form feature?


Skip,

[glasses] [red]A palindrome gone wrong?[/red]
A man, a plan, a ROOT canal...
PULLEMALL![tongue]
 
Hello Skip,
What we are trying to find here is basically if the users zip code has changed, they need to enter the new one along with the associated marketplace.
We are basically trying to get informaiton based on these 2 fields only.

This is the brief description of what I want done.

This process should begin by clicking a button called "Start Process" and the functionality will start with the first record.

Click the button, message box comes up
The box wil have a message on top that says enter the following information and will have 2 fields "Zipcode" and Marketplace"
The user will enter the zipcode and marketplace information, Below that will be 2 buttons "Add More" and Next Record"
When user clicks on "Add More", the message box refreshes and allows them to enter next set of zipcode and marketplace.
This can continue as much as the user want. Whatever values they enter in the box should be displayed on the worksheet (as shown in green)
When the user clicks "Next Record", the message box should correspond with the next row and so on like a Loop.

Attached is a sample excel of what i want to achieve.
Note the fields in green. Thats where the final results need to be.

If you can think of any cooler ideas let me know. I am open for suggestions.
Urgent requirment

A good programmer is someone who looks both ways before crossing a one-way street. - Doug Linder
 


What have you coded so far and where are you stuck?

Skip,

[glasses] [red]A palindrome gone wrong?[/red]
A man, a plan, a ROOT canal...
PULLEMALL![tongue]
 
Hello Skip,
Here is my code so far in Excel VBA. Using a form...ofcourse

I am stuck with "NextRec_Click()"
I want this button to skip to the next record and be ready to start from While Range("H1").Item(1, Col1).Value <> "" + 1 kind of logic.

Currently my regular fields end at H, then the new fields that get added (via AddMore_Click()) in I2 for row 1

So when user click on NextRec_Click(),the new values entered for txtZIP.Text & txtMP.Text need to get dumped in I3.
if the user hit the NextRec_Click() button twice then it should take user to the 3 row..

Code:
' Function to add more records
Private Sub AddMore_Click()
Dim Col1, Col2 As Integer
Col1 = 1
While Range("H1").Item(1, Col1).Value <> ""
Col1 = Col1 + 1
Wend
Range("H1").Item(1, Col1).Value = "ZIP Code"
Range("H1").Item(2, Col1).Value = txtZIP.Text
Range("H1").Item(1, Col1 + 1).Value = "Market Place"
Range("H1").Item(2, Col1 + 1).Value = txtMP.Text

txtZIP.Text = ""
txtMP.Text = ""


End Sub

Private Sub Cancel_Click()
Unload Me
End Sub

'Code the skip to the next record.
Private Sub NextRec_Click()

End Sub

Private Sub UserForm_Click()

End Sub

A good programmer is someone who looks both ways before crossing a one-way street. - Doug Linder
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top