Hi Tricia, could share a sample file
tks. Basole 2014-02-13 17:33 GMT-02:00 Tricia Guitard <tguitar...@gmail.com>: > I am very new to VBA but I have learned so much thanks these forums so > thank you! I could really use some help right now. > > I have created a questionnaire in Excel. For each question, the user > answers yes, no, or NA. If the answer is no, they have to select the error > from a list which generates an error code. > I currently have code to show a Userform when these 2 conditions are met > (answer is no, and error code is generated). This piece code was > working, or at least I thought it was.....the form appears to be opening > with only one condition on other lines (when the error code is generated) > > [image: copy to clipboard] > > Private Sub Worksheet_Change(ByVal Target As Range) > If Range("I17").Value = "1" And Range("J17").Value <> "" Then > FrmDetails.Show > End If > End Sub > > (this is for question number 1) > > [image: copy to clipboard] > > If Range("I18").Value = "1" And Range("J18").Value <> "" Then > FrmDetails.Show > End If > End Sub > > (this is for question 2) > > And this continues for all questions. This part I am ok with. > > So it goes like this - > Question 1 - the 2 conditions are met, the form opens, the user enters > additional information about the error and clicks on "save". This > information is saved to a specific line in the worksheet (the user doesn't > see where the information goes). Before the code above, I was able complete > the form for the first question and the information was saved to the > correct line for the first question. > > This is where I need help. > When I get to the next question, if the condition is met, the form opens, > but this time, when they hit save, I need it to save to the appropriate > line (not he same line as question 1). > > I need something like this.... > Question 1, if the 2 conditions are met > > [image: copy to clipboard] > > Private Sub Worksheet_Change(ByVal Target As Range) > If Range("I17").Value = "1" And Range("J17").Value <> "" Then > FrmDetails.Show > End If > End Sub > > THEN I need to add something here (I assume) to call the CmdSave button > that will save to line 17 > > [image: copy to clipboard] > > Sub CmdSave_Click17() > Range("K17").Value = txtAgentName1.Text > Range("L17").Value = txtPPC1.Text > Range("M17").Value = CBLevel1.Text > Range("N17").Value = CBGroup1.Text > Range("O17").Value = CBErrorObs1.Text > Range("P17").Value = CBDecisionType1.Text > Range("Q17").Value = CBWorkItem1.Text > Range("R17").Value = CBIssue1.Text > End Sub > > Question 2, if the 2 conditions are met > > [image: copy to clipboard] > > If Range("I18").Value = "1" And Range("J18").Value <> "" Then > FrmDetails.Show > End If > End Sub > > [image: copy to clipboard] > > Sub CmdSave_Click18() > Range("K18").Value = txtAgentName1.Text > Range("L18").Value = txtPPC1.Text > Range("M18").Value = CBLevel1.Text > Range("N18").Value = CBGroup1.Text > Range("O18").Value = CBErrorObs1.Text > Range("P18").Value = CBDecisionType1.Text > Range("Q18").Value = CBWorkItem1.Text > Range("R18").Value = CBIssue1.Text > End Sub > > .....then continue like that. > > basically, each time a condition is met and the form is called, I need it > to save the information to the appropriate line. > > Any suggestions would be so appreciated. > > Trish > > Note - Also, I just noticed that even though the form loads, when I go to > enter information now and hit save, I get the following error message > "Form already displayed; can't show modally" > > > -- > Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It's > =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ > https://www.facebook.com/discussexcel > > FORUM RULES > > 1) Use concise, accurate thread titles. Poor thread titles, like Please > Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice > will not get quick attention or may not be answered. > 2) Don't post a question in the thread of another member. > 3) Don't post questions regarding breaking or bypassing any security > measure. > 4) Acknowledge the responses you receive, good or bad. > 5) Jobs posting is not allowed. > 6) Sharing copyrighted material and their links is not allowed. > > NOTE : Don't ever post confidential data in a workbook. Forum owners and > members are not responsible for any loss. > --- > You received this message because you are subscribed to the Google Groups > "MS EXCEL AND VBA MACROS" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to excel-macros+unsubscr...@googlegroups.com. > To post to this group, send email to excel-macros@googlegroups.com. > Visit this group at http://groups.google.com/group/excel-macros. > For more options, visit https://groups.google.com/groups/opt_out. > -- Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It's =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ https://www.facebook.com/discussexcel FORUM RULES 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Jobs posting is not allowed. 6) Sharing copyrighted material and their links is not allowed. NOTE : Don't ever post confidential data in a workbook. Forum owners and members are not responsible for any loss. --- You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group. To unsubscribe from this group and stop receiving emails from it, send an email to excel-macros+unsubscr...@googlegroups.com. To post to this group, send email to excel-macros@googlegroups.com. Visit this group at http://groups.google.com/group/excel-macros. For more options, visit https://groups.google.com/groups/opt_out.