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

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

Forum statistics

Threads
1,216,101
Messages
6,128,835
Members
449,471
Latest member
lachbee

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