How to Fix Error - Adding lines with a macro?

Adding lines with a macro

Hello,
Lately I have been trying to make a macro to add a certain number of lines.
But each time it returns an error.

What I would like is to have an InputBox where I enter a number.
Then the macro adds this number of lines.

I have this part: 
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove

and the InputBox

v1 = InputBox("Which amount?")

But how would you make the macro add the "v1" number in number of rows?

Thankful for any advice!

Anwsers to the Problem Adding lines with a macro

Download Error Fixer for Free Now

In the following code it does not matter if you select one cell or the entire row for the position to insert the lines.

    Dim r As Long
    Dim v1 As Long
   
    r = Selection.Rows(1).Row
    v1 = InputBox("Which amount?")
    v1 = v1 - 1
    Rows(r & ":" & r + v1).Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove

Manually editing the Windows registry to fix Error Adding lines with a macro

Caution: Unless you an advanced computer user, we DO NOT recommend editing the Windows registry manually. Using Registry Editor incorrectly can cause serious problems that may require you to reinstall Windows. We do not guarantee that problems resulting from the incorrect use of Registry Editor can be solved. Use Registry Editor at your own risk.

  • Click the Start button.
  • Type "command" in the search box... DO NOT hit ENTER yet!
  • While holding CTRL-Shift on your keyboard, hit ENTER.
  • You will be prompted with a permission dialog box.
  • Click Yes.
  • A black box will open with a blinking cursor.
  • Type "regedit" and hit ENTER.
  • In the Registry Editor, select the Error 0x9C-related key (eg. Windows Operating System) you want to back up.
  • From the File menu, choose Export.
  • In the Save In list, select the folder where you want to save the Windows Operating System backup key.
  • In the File Name box, type a name for your backup file, such as "Windows Operating System Backup".
  • In the Export Range box, be sure that "Selected branch" is selected.
  • Click Save.
  • The file is then saved with a .reg file extension.
  • You now have a backup of your MACHINE_CHECK_EXCEPTION-related registry entry.

Recommended Method to Fix the Problem: Adding lines with a macro:

How to Fix Adding lines with a macro with SmartPCFixer?

1. Download Error Fixer . Install it on your system.  Click Scan, and it will perform a scan for your computer. The junk files will be shown in the list.

2. After the scan is done, you can see the errors and problems need to be repaired. Click Fix All.

3. The Repair part is done, the speed of your computer will be much higher than before and the errors have been removed. You can also use other functions in SmartPCFixer. Like dll downloading, junk file cleaning and print spooler error repair.


Related: How to Fix - 64g ssd with a 500g regular drive?,Allow Unhide Rows in Protected Workbook [Solved],[Solved] Get in Excel 2007 data from Access 2007 out of self-built Queries,[Solution] How can I temporarily disable 'service manager' to install Adobe flashplayer?,[Anwsered] When I try to watch a flash video, I am told occasionally that I don't have Adobe Flash.,Solution to Error: Black screen during boot sequence,[Solved] Can't restore Windows 7 64-bit from external hard drive,How to Fix - IE 11 Enhance Protect Mode reset issue with add-on's?,Solution to Error: Internet Explorer 9 update/install error - Error Code 80092004,Upgrading to IE 8 causes cookies to get deleted when starting IE [Anwsered],Solution to Problem: All programs try to start from windows component
,Troubleshoot:External Hard Drive not listed in Windows 7 backup wizard Error
,How to Fix Error - Getting an error "not connected to the internet" while trying to install Samsung Kies?
,How to Fix - Internet Explorer shuts down and reopens tab when attaching to email or uploading files.?
,Fast Solution to Problem: Sending Error Message
,[Anwsered] Thinkpad 8611 Boot,How to Resolve - Svchost Helper?,Fast Solution to Problem: L30 101 Driver Windows 7,Troubleshooter of Error: Io Device,How to Fix Error - Dell Laptop Code 39?
Read More: [Solved] Adobe PDF Maker not working.....,Troubleshooting:Adobe reader 8.1 has stop working but does not update,Fast Solution to Error: Add-in available for managing hidden text?,[Solved] added 8 GM ram only see 3.25 in win 7 64-bit,Troubleshoot:Adobe says incompatible with yellow triangle icon,a file called mDNSResponse.exe. is causing bonjour not to operate properly,what should I do?,A QUESTION USING THE "IF'S" Formula.,A continuos flashing window with which title is C:Windows\System32\cmd.exe, and has the following message: The syntax of the command is incorrect.,Acrobat compatibility issue and you tube problems____,ActiveX on IE 9 not loaded
Comments