2016년 3월 31일 목요일

Adding a new line by means of a macro

Adding a new line by means of a macro

Hello Excel(lent) users,
 
I have been given a file which I can use to register issues.
It came with lots of macros.
 
One of them is used to register a new issue:
Rows("12:12").Select
    Selection.Insert Shift:=xlDown
    Range("A9").Select
    Selection.Copy
    Range("A12").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("B9:N9").Select
    Selection.Copy
    Range("B12").Select
    Selection.PasteSpecial Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("A12").Select
 
If I understand it correctly it copys row 9 and paste it in row 12 (always).
 
Now here is the catch:
I want to change it in such a way, that it does not create a new line in row 12 (as shown above), but in the first row that is empty after the last row with information.
And on top of that I want the issue nr (1st column) to add up a digit/number.
 
For instance at this point of time there are 1122 issues registered.
This last issue is positioned in row 1121.
So if now I want to add another issue, I don;t want it to be placed in row 12, but in row 1122, with issue number 1123.
And the next one behind
that in row 1123 with issue number 1124 (so adding one number each time a new issue is raised).
 
How should I enhance the above mentioned Macro?
 
Thanx for helping me out !
 
Take care,
 
Jaydubs

Anwsers to the Problem Adding a new line by means of a macro

Download Error Fixer (Free)

No, just replace the fourth row of Hans's macro:
 
Dim r As Long
r = Range("A" & Rows.Count).End(xlUp).Row + 1
Range("A" & r) = Range("A" & (r - 1)) + 1
Range("A9:N9").Copy Destination:=Range("A" & r)
Range("A" & r).Select

Manually editing the Windows registry

Caution: Unless you an advanced PC user, please do not edit the Windows registry manually.

Because of this risk, we highly recommend using a trusted registry cleaner such as SmartPCFixer Using a registry cleaner automates the process of finding invalid registry entries, missing file references (like the one causing your MACHINE_CHECK_EXCEPTION error), and broken links within the registry. A backup is automatically created before each scan, with the ability to undo any changes in a single click, protecting you against the possibility of PC damage. The best part is that repairing registry errors can also dramatically improve system speed and performance.

  • 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.

The next steps in manually editing your registry will not be discussed in this article due to the high risk of damaging your system. If you would like to learn more about manual registry editing, please see the links below.

Another Safe way to Fix the Problem: Adding a new line by means of a macro:

How to Fix Adding a new line by means of a macro with SmartPCFixer?

1. Download Error Fixer. Install it on your computer.

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

3. When the Fixing part is finished, your computer has been speeded up and the errors have been removed


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: Troubleshooting:add-ins are not showing up,How to Fix Error - After Cisco AnyConnect VPN Client connected access to Internet sites becomes unavailable.?,Solution to Problem: After a recent windows7 update, my laptop no longer recognises netflix.com.,[Solved] Advanced tab is missing under Internet Options,How to Fix Error - Address fields mismatched after installing KB829918?,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

댓글 없음:

댓글 쓰기