Removing Input Box from Macro

luckyajr

Board Regular
Joined
Mar 21, 2011
Messages
96
Hi All,

I found a very helpful code that I have used in one of my spreadsheets. I am hoping to have it amended to where the input box is removed and instead it automatically inserts the rows based upon the cell value of "A1". As it is currently written, the input box pops up and the user then has to hit enter, I don't want to have the user hit enter after the macro is run. Your thoughts are appreciated. THANKS!

Code:
ActiveCell.Copy  'So you do not have to preselect entire row
   If vRows = 0 Then
    vRows = Application.InputBox(prompt:= _
      "How many rows do you want to add?", Title:="Add Rows", _
      Default:=Range("A1"), Type:=1) 'Default for 1 row, type 1 is number
    If vRows = False Then Exit Sub
    
   End If
 
Sorry for late response! Somehow I never noticed that you had replied to this thread. Great advice! I think I got things figured out with it. Really appreciate it.
 
Upvote 0

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

Forum statistics

Threads
1,224,548
Messages
6,179,448
Members
452,915
Latest member
hannnahheileen

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