restrict copy data from userform to all sheets based on row number

Hasson

Active Member
Joined
Apr 8, 2021
Messages
390
Office Version
  1. 2016
Platform
  1. Windows
hi

I would add condition like message box to this code . the code works for one sheet, but I want through all the sheets are existed in the file . so when I fill data in first sheet and reach to 1000 rows should pop up message has two choices " it 's filled 1000 rows" .if press ok then should move to next sheet and fill just 1000 rows and so on for rest of sheets and if I press no then should keep in first sheet and fill data without any limition.
VBA Code:
Private Sub CMDS()
Dim LR As long
LR = Cells(Rows.Count, "B").End(xlUp).Row + 1
Cells(LR, 1).Value = Me.TETPR.Value
Cells(LR, 2).Value = Me.TXTMM.Value
Cells(LR, 3).Value = Me.TXTNB.Value
Cells(LR, 4).Value = Me.TXTAA.Value
MsgBox "DONE"
TETPR.Value = ""
TXTMM.Value = ""
TXTNB.Value = ""
TXTAA.Value = ""
End Sub
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Forum statistics

Threads
1,214,789
Messages
6,121,593
Members
449,038
Latest member
Arbind kumar

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