Userform for input of single value and ranges

Brutusar

Board Regular
Joined
Nov 23, 2019
Messages
166
Office Version
  1. 365
Platform
  1. Windows
I am using a VBA code doing the value input directly in the code, but it is really slow when values has to be changed as you can imagine.

How can I modify this code so I can use input in a user form for some of the values? This is the code, it copies a range, and past it n times in a different sheet. What I am looking for is to select the range in a inputbox, then enter how many times the range should be pasted into either the same sheet, or in a different sheet.

Sub CopyPaste()
Application.ScreenUpdating = False

i& = Sheet1.Cells(Rows.Count, 5).End(xlUp).Row
k& = 2

For j& = 1 To 26
Sheet1.Range("A1:B3" & i).Copy
Sheet2.Range("E" & k).PasteSpecial
Application.CutCopyMode = False
k = k + 1
Next

Application.ScreenUpdating = True
End Sub
 
And my code shows this:
If OptionButton1.Value = True Then sn = "Alpha"

Which means you must have a sheet named "Alpha"

Modify this to the proper sheet name.

See you did not provide specific details so you must modify my code to meet your needs.
Or provide specific details
 
Upvote 0

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

Forum statistics

Threads
1,215,527
Messages
6,125,336
Members
449,218
Latest member
Excel Master

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