delete rows cued by number of blank cells (VBA script)
I have a spreadsheet with 15,000 rows of data.
I need to delete 98% of the rows and capture the data in only those 3 rows that can be found after two blank cells in Column C. So if these cells are blank (C3, C6, C7, C9, C22, C23, C25, C45, C46, C48, C100,
C101, C103) then I need to delete all the rows except row 8-9-10, row 24-25-26, row 47-48-49, and rows 102-103-104, etc.. So I need to tag row 1 as the start of the rows to delete and row 7 as the end of the rows to delete.
Then I need to tag row 11 as the
start of rows to delete follows by row 23 as the last row to delete.
There is a blank cell in the center of each of the three rows that will be kept in the resulting spreadsheet (e.g.
row 9 and row 25 on the original spreadsheet).
There are NO instances of more than 2 consecutive blank cells in column C until the end of the data, at which point the program can run to the end of the spreadsheet for all I care, since this is a one time cleanup (although I will run the cleanup on a number
of different spreadsheets).
Can you help with the code for this? (I assume this will use VBA script.)
Anwsers to the Problem delete rows cued by number of blank cells (VBA script)
Sub TestMacro1()
Dim rK As Range
Range("A1").EntireColumn.Insert
Range("A1:A3").EntireRow.Insert
Range("A1").Value = "Discard"
Range("A2").Value = "Discard"
Range("A3").Value = "Discard"
Range("A4:A" & Cells(Rows.Count, "D").End(xlUp).Row).FormulaR1C1 = _
"=IF(AND(COUNTIF(R[-3]C:R[-1]C,""Keep"")<3,R[-1]C=""Keep"",RC[3]<>""""),""Keep"",IF(AND(R[-2]C[3]="""",R[-1]C[3]="""",RC[3]<>""""),""Keep"",""Discard""))"
Columns("A:A").Value = Columns("A:A").Value
Cells.Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Set rK = Columns("A:A").Find(What:="Keep", After:=Range("A1"), LookIn:=xlValues, _
LookAt:=xlWhole)
Range("A1", rK(0)).EntireRow.Delete
Range("A1").EntireColumn.Delete
End Sub
- Download the Microsoft Windows ISO (installation device) from the following website:
- http://www.microsoft.com/en-us/software-download/windows10
- Users must select the appropriate ISO, either 32 bit or 64 bit, depending upon their individual computer.
- Extract the ISO file to a separate USB device or burn the program to a compact disc.
- Run the Microsoft Windows 10 upgrade directly from the software that you have thus created.
Recommended Method to Repair the Problem: delete rows cued by number of blank cells (VBA script):
How to Fix delete rows cued by number of blank cells (VBA script) with SmartPCFixer?
1. Click the button to download SmartPCFixer . Install it on your computer. Open it, and it will scan your system. The errors will be shown in the scan result.
2. After the scan is done, you can see the errors and problems need to be fixed. Click Fix All.
3. The Repair part is finished, the speed of your computer will be much higher than before and the errors have been fixed. You can also use other functions in SmartPCFixer. 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: Solution to Error: Delete module in VBA Excel ?,Troubleshoot:DEP shuts down IE,How to Fix Problem - Custom ribbon tab in Excel 2007 doesn't appear?,How Can You Fix - Data table in bar chart?,[Anwsered] Deleting sites visted in the web address bar history. Yes I have tried deleting temp internet files but three sites remain in the web address bar history
댓글 없음:
댓글 쓰기