Getting an Inputbox value to work in a later formula

Sweedler

Board Regular
Joined
Nov 13, 2020
Messages
114
Office Version
  1. 2016
Platform
  1. Windows
  2. MacOS
Ok, SO I have been working on this MACRO that would allow me to enter a variable number of rows into my spreadsheet from a variable point. Excel is telling me that I am mucking up in the last step with the "ROWS(..." line. I just can't really figure out why it wont work and would love some help solving this one.




Sub InsertROWS()

Dim a As Integer
Dim b As Integer
Dim c As Integer

a = Application.InputBox("how many rows do you wish to add", "ADDING ROWS", Type:=1)

b = Application.InputBox("Starting from what row", "STARTING POINT", Type:=1)

c = ((a - 1) + b)

Range("e2").Value = a
Range("e3").Value = c

Rows("a:c").Value.EntireRow.Insert

End Sub
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

Forum statistics

Threads
1,215,473
Messages
6,125,018
Members
449,203
Latest member
tungnmqn90

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