Row Range Problem In User Form?

Khalid R

New Member
Joined
Sep 12, 2021
Messages
1
Office Version
  1. 365
  2. 2016
  3. 2010
Platform
  1. Windows
Hi !
I have built a user form to enter data of my field of Radish in point of Sales Record. The form is working good and entering the values correctly by these codes. But I have put some charts and additional data in my excel sheet upper rows. User form enters the value at the 2nd top row and continuously entering the values. But I want it to enter the value from row 13. Because I add data in first 12 rows. But user form keeps inserting data to his previous rows. I have tried different ways but it did not worked at all.
User form works correctly when there is nothing in sheet. But when I write data or charts in upper rows i mean at top then User form adding the value randomly. I want it to add the value in row 13. and so on. I also attached some images for better understanding.

After (I want to add values in row 13 instead of row 2)
Screenshot (44).png

Before (form works correctly in this sheet with out charts)
Screenshot (45).png

Screenshot (46).jpg

My Codes are below:

Private Sub Label1_Click()

Dim lr As Long
lr = Sheets("Radish Record").Range("A" & Rows.Count).End(xlUp).Row + 1

lr = Sheets("Radish Record").Range("A" & Rows.Count).End(xlUp).Row + 1
Sheets("Radish Record").Cells(lr, 1) = Me.TextBox2.Value
Sheets("Radish Record").Cells(lr, 2) = Me.TextBox3.Value
Sheets("Radish Record").Cells(lr, 3) = Me.TextBox4.Value
Sheets("Radish Record").Cells(lr, 4) = Me.TextBox5.Value
Sheets("Radish Record").Cells(lr, 5) = Me.TextBox6.Value
Sheets("Radish Record").Cells(lr, 6) = Me.TextBox7.Value
Sheets("Radish Record").Cells(lr, 7) = Me.TextBox8.Value
Sheets("Radish Record").Cells(lr, 8) = Me.TextBox9.Value
Sheets("Radish Record").Cells(lr, 9) = Me.TextBox10.Value
Sheets("Radish Record").Cells(lr, 10) = Me.TextBox11.Value
Sheets("Radish Record").Cells(lr, 11) = Me.TextBox12.Value


Me.TextBox2.Value = ""
Me.TextBox3.Value = ""
Me.TextBox4.Value = ""
Me.TextBox5.Value = ""
Me.TextBox6.Value = ""
Me.TextBox7.Value = ""
Me.TextBox8.Value = ""
Me.TextBox9.Value = ""
Me.TextBox10.Value = ""
Me.TextBox12.Value = ""

'Sheets("Radish Record").Range("A2") = Me.TextBox2.Value
'Sheets("Radish Record").Range("B2") = Me.TextBox3.Value
'Sheets("Radish Record").Range("C2") = Me.TextBox4.Value
'Sheets("Radish Record").Range("D2") = Me.TextBox5.Value
'Sheets("Radish Record").Range("E2") = Me.TextBox6.Value
'Sheets("Radish Record").Range("F2") = Me.TextBox7.Value
'Sheets("Radish Record").Range("G2") = Me.TextBox8.Value
'Sheets("Radish Record").Range("H2") = Me.TextBox9.Value
'Sheets("Radish Record").Range("I2") = Me.TextBox10.Value
'Sheets("Radish Record").Range("k2") = Me.TextBox12.Value
End Sub

Private Sub Label2_Click()
Unload Me
End Sub

Private Sub UserForm_Click()
End Sub


Any Help Will be Highly Appreciated!! Thanks:):)...
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Hi.
The images you've posted are from different sheets and even from different files.

If you intend to enter data on the RadishRecords sheet (your first image) then the code line that looks up for the last row with data should be changed to Sheets("RadishRecord"), instead of "Radish Record" , (your second image) which is another sheet (it has a space inside it's name).

Also, all lines from your code should be reviewed to refer to the correct sheet that will receive the data.
 
Upvote 0

Forum statistics

Threads
1,224,837
Messages
6,181,255
Members
453,028
Latest member
letswriteafairytale

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