2016년 9월 26일 월요일

How to Fix - Delete rows based on several conditions macro?

Delete rows based on several conditions macro

Hi there,
I have a spreadsheet that contain data from column A to Z.

Can I create a macro that does the following 2 things:
a.
Look at each row and for example if in cell X25 has the number 0 and in corresponding cell Q25 has letter A, then delete that entire row.  Or if both cells are blank then also delete that row.
b.
Look at each row in column Z.
If there is a cell that has only one digit (say a number 5), then add a 0 in from of it (05).
 
Also, can this macro start running from the bottom up to row 7?
 
Thank you very much....

Keys to the Problem Delete rows based on several conditions macro

Download Error Fixer for Free Now

Hi there,
I have a spreadsheet that contain data from column A to Z.

Can I create a macro that does the following 2 things:
a.
Look at each row and for example if in cell X25 has the number 0 and in corresponding cell Q25 has letter A, then delete that entire row.  Or if both cells are blank then also delete that row.
b.
Look at each row in column Z.
If there is a cell that has only one digit (say a number 5), then add a 0 in from of it (05).
 
Also, can this macro start running from the bottom up to row 7?
 
Thank you very much....


Try this macro:

Sub conditional_rowdelete()
  Dim ws As Worksheet
  Dim r, firstrow, lastrow As Integer
  Set ws = Worksheets("Sheet1")  ' edit sheet name to your needs
  With ws
    firstrow = 7
    lastrow = .Cells.SpecialCells(xlCellTypeLastCell).Row
    For r = lastrow To firstrow Step -1
      If .Cells(r, "Z") >= 0 And .Cells(r, "Z") < 10 Then
        .Cells(r, "Z").NumberFormat = "00"
      End If
      If .Cells(r, "X") = 0 And .Cells(r, "Q") = "A" Or .Cells(r, "X") = "" And .Cells(r, "Q") = "" Then
         .Rows(r).Delete
      End If
    Next r
  End With
End Sub

Hope this helps / Lars-Åke

Note: It is recommended that you back up your files and folders before attempting this step:

  • Move the mouse cursor over to the upper right side of the screen.
  • A menu will pop up on the left. Click on the "Settings" feature on the menu.
  • On the Settings window, click on the "Change PC settings."
  • Now, left click on the "Update and recovery" feature.
  • For the next step, left click on the "Recovery" feature.
  • There is an option here saying "Refresh your PC without affecting your files." There, left click on the "Get started" button.
  • Now, follow the instructions on the screen to finish the Refresh process.
  • After the Refresh process has finished restart your Windows 8.1 or Windows 8 device.
  • Check again to see if the error Delete rows based on several conditions macro has been fixed.

If you do not possess the technical expertise required to accomplish this yourself or do not feel comfortable doing so, download and install a powerful automated tool to get the job done.

Another Safe way to Fix the Problem: Delete rows based on several conditions macro:

How to Fix Delete rows based on several conditions macro with SmartPCFixer?

1. You can Download SmartPCFixer here. Install it on your computer. When you open it, it will perform a scan.

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 fixed. You can also use other functions in this software. Like dll downloading, junk file cleaning and print spooler error repair.


Related: How to Update & Download NVidia GeForce 6100/nForce 420 WHQL Certified driver v.178.13,How to Update & Download NVidia GeForce 7600 GS Video Driver v.295.75 Certified,How Can I Update & Download NVidia GeForce 820M Driver v.344.48 WHQL,[Solved] Download NVidia GeForce GTX 560M VGA Driver v.296.17 Certified,Way to Update & Herunterladen NVidia GeForce GT 130M Video Treiber v.295.75 Certified,How to Update & Download SONY SVE14A1X1RH Realtek Ethernet Driver,Where to Download SONY SVS13A2W9ES Bluetooth Driver (Intel) v.2.6 - 2.6.23.40059,Best Way to Update & Download SONY VGN-CR203E Conexant HDAUDIO SoftV92 Data Fax Modem with SmartCP Setup Program v.7.62.0.50 driver,Best Way to Download SONY VGN-FE790G/N Wireless LAN Driver v.10.6.0.29,Method to Update & Download SONY VGN-NR31Z/S Firmware Extension Parser Device v.8.0.2.3,How to Fix Error 0x0000c1f5 Solución?,Error 0x80071a91 Win7 Fix Patch,Error 0x800ccc60 Windows Live Mail [Solved],Error Message 0x800ccc79 Outlook 2000 Fix,What is Error 0xc1ab0001?,[Answered] x64 saplugin dll,How to Fix Problem - Kb943729 Download?,Troubleshooting: Bccode D1 Error,Java Runtime Tech Support,Troubleshooting: ERROR NO SUCH GROUP Error
Read More: Tech Support: Default Active Partition now appears as "Free Space",How to Fix Error - Delete individual URL from address bar in IE7?,Fast Solution to Error: data source reference is not valid,Delete leading zeroes,Troubleshooting:Custom error bars disappear Error

댓글 없음:

댓글 쓰기