How to use the same textbox to get different values

miszKiera

New Member
Joined
Oct 25, 2021
Messages
1
Office Version
  1. 2010
Platform
  1. Windows
Hello

I have two userform where on the first one, when user click option 'No', a remark userform will pop up for the user to write the remarks then paste it on the first userform main remark textbox (for view purpose only). I have multiple questions with 'No' options and I want for every questions, everytime the user click 'No', the remarks userform will pop up and get the remarks. My problem here, the remark userform get the value, but if I write the remark for another question, the new remark now replacing the other question's remark. How do i fix this?

VBA Code:
Sub Remarks()
    Dim sh2 As Worksheet
    Dim iRow As Long
    Dim rm1, rm2_1, rm2_2, rm2_3, rm2_4, rm2_5
    Dim rm3_1, rm3_2
    Dim rm4, rm5
    Dim rm6_1, rm6_2, rm6_3
    Dim rm7
    Dim rm8_1, rm8_2, rm8_3, rm8_4, rm8_5
    Dim rm9_1, rm9_2
    
    Set sh2 = ThisWorkbook.Sheets("Remarks")
    
    iRow = [Counta(Remarks!A:A)] + 1
    
    With sh2
        .Cells(iRow, 1) = frmForm.txtDrawingNo.Value
        .Cells(iRow, 2) = frmForm.txtPrepared.Value
        .Cells(iRow, 3) = frmForm.txtBuyoff.Value
        .Cells(iRow, 4) = frmForm.txtDate.Value
        
        
        If frmForm.NO_1_1.Value Then
        rm1 = frmRemark.txtRemark.Value
        frmForm.txtRemarks_1.Value = rm1
        .Cells(iRow, 5) = "1: Treatment Requirement"
        .Range("F" & iRow).Value = rm1
        End If
        
        If frmForm.NO_2_1.Value Then
        rm2_1 = frmRemark.txtRemark.Value
        frmForm.txtRemarks_2_1.Value = rm2_1
        .Cells(iRow, 5) = "2: Programmed References"
        .Range("F" & iRow).Value = rm2_1
        End If
        
        
        If frmForm.NO_2_2.Value Then
        rm2_2 = frmRemark.txtRemark.Value
        frmForm.txtRemarks_2_2.Value = rm2_2
        .Cells(iRow, 5) = "2: Programmed References"
        .Range("F" & iRow).Value = rm2_2
        End If
        
        If frmForm.NO_2_3.Value Then
        rm2_3 = frmRemark.txtRemark.Value
        frmForm.txtRemarks_2_3.Value = rm2_3
        .Cells(iRow, 5) = "2: Programmed References"
        .Range("F" & iRow).Value = rm2_3
        End If
        
        If frmForm.NO_2_4.Value Then
        rm2_4 = frmRemark.txtRemark.Value
        frmForm.txtRemarks_2_4.Value = rm2_4
        .Cells(iRow, 5) = "2: Programmed References"
        .Range("F" & iRow).Value = rm2_4
        End If
        
        If frmForm.NO_2_5.Value Then
        rm2_5 = frmRemark.txtRemark.Value
        frmForm.txtRemarks_2_5.Value = rm2_5
        .Cells(iRow, 5) = "2: Programmed References"
        .Range("F" & iRow).Value = rm2_5
        End If
        
        If frmForm.NO_3_1.Value Then
        rm3_1 = frmRemark.txtRemark.Value
        frmForm.txtRemarks_3_1.Value = rm3_1
        .Cells(iRow, 5) = "3: Tool List Relevant"
        .Range("F" & iRow).Value = rm3_1
        End If
        
        If frmForm.NO_3_2.Value Then
        rm3_2 = frmRemark.txtRemark.Value
        frmForm.txtRemarks_3_2.Value = rm3_2
        .Cells(iRow, 5) = "3: Tool List Relevant"
        .Range("F" & iRow).Value = rm3_2
        End If
        
        If frmForm.NO_4_1.Value Then
        rm4 = frmRemark.txtRemark.Value
        frmForm.txtRemarks_4.Value = rm4
        .Cells(iRow, 5) = "4: Cycle Time Estimated"
        .Range("F" & iRow).Value = rm4
        End If
        
        If frmForm.NO_5_1.Value Then
        rm5 = frmRemark.txtRemark.Value
        frmForm.txtRemarks_5.Value = rm5
        .Cells(iRow, 5) = "5: Clearance Plane (CP)"
        .Range("F" & iRow).Value = rm5
        End If
        
        If frmForm.NO_6_1.Value Then
        rm6_1 = frmRemark.txtRemark.Value
        frmForm.txtRemarks_6_1.Value = rm6_1
        .Cells(iRow, 5) = "6: Engraving (CNC Engrave)"
        .Range("F" & iRow).Value = rm6_1
        End If
        
        If frmForm.NO_6_2.Value Then
        rm6_2 = frmRemark.txtRemark.Value
        frmForm.txtRemarks_6_2.Value = rm6_2
        .Cells(iRow, 5) = "6: Engraving (CNC Engrave)"
        .Range("F" & iRow).Value = rm6_2
        End If
        
        
        If frmForm.NO_6_3.Value Then
        rm6_3 = frmRemark.txtRemark.Value
        frmForm.txtRemarks_6_3.Value = rm6_3
        .Cells(iRow, 5) = "6: Engraving (CNC Engrave)"
        .Range("F" & iRow).Value = rm6_3
        End If
        
        If frmForm.NO_7_1.Value Then
        rm7 = frmRemark.txtRemark.Value
        frmForm.txtRemarks_7_1.Value = rm7
        .Cells(iRow, 5) = "7: Cutting Compensation Offset (CCO)"
        .Range("F" & iRow).Value = rm7
        End If
        
        If frmForm.NO_8_1.Value Then
        rm8_1 = frmRemark.txtRemark.Value
        frmForm.txtRemarks_8_1.Value = rm8_1
        .Cells(iRow, 5) = "8: Instruction in 2D / 3D Diagram"
        .Range("F" & iRow).Value = rm8_1
        End If
        
        If frmForm.NO_8_2.Value Then
        rm8_2 = frmRemark.txtRemark.Value
        frmForm.txtRemarks_8_2.Value = rm8_2
        .Cells(iRow, 5) = "8: Instruction in 2D / 3D Diagram"
        .Range("F" & iRow).Value = rm8_2
        End If
        
        If frmForm.NO_8_3.Value Then
        rm8_3 = frmRemark.txtRemark.Value
        frmForm.txtRemarks_8_3.Value = rm8_3
        .Cells(iRow, 5) = "8: Instruction in 2D / 3D Diagram"
        .Range("F" & iRow).Value = rm8_3
        End If
        
        If frmForm.NO_8_4.Value Then
        rm8_4 = frmRemark.txtRemark.Value
        frmForm.txtRemarks_8_4.Value = rm8_4
        .Cells(iRow, 5) = "8: Instruction in 2D / 3D Diagram"
        .Range("F" & iRow).Value = rm8_4
        End If
        
        If frmForm.NO_8_5.Value Then
        rm8_5 = frmRemark.txtRemark.Value
        frmForm.txtRemarks_8_5.Value = rm8_5
        .Cells(iRow, 5) = "8: Instruction in 2D / 3D Diagram"
        .Range("F" & iRow).Value = rm8_5
        End If
        
        If frmForm.NO_9_1.Value Then
        rm9_1 = frmRemark.txtRemark.Value
        frmForm.txtRemarks_9_1.Value = rm9_1
        .Cells(iRow, 5) = "9: Program Simulation Preview"
        .Range("F" & iRow).Value = rm9_1
        End If
        
        If frmForm.NO_9_2.Value Then
        rm9_2 = frmRemark.txtRemark.Value
        frmForm.txtRemarks_9_2.Value = rm9_2
        .Cells(iRow, 5) = "9: Program Simulation Preview"
        .Range("F" & iRow).Value = rm9_2
        End If
        
    End With
    
    
End Sub

qq1.JPG

Notice that when i create the new remarks using the remark userform, it alter the previous remark.
qq2.JPG
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

Forum statistics

Threads
1,215,045
Messages
6,122,840
Members
449,096
Latest member
Erald

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top