Dear Mike,

Following code will delete the blank rows and columns as per your
requirements:-

Sub delRows()
Cells(1, 1).Select
For n = 1 To Range("a65536").End(xlUp).Row
Selection.EntireRow.Select
If Application.WorksheetFunction.CountA(Selection) = 0 Then
Selection.EntireRow.Delete
Else
ActiveCell.Offset(1, 0).Select
End If
Next n
For k = 1 To 10
Selection.EntireColumn.Select
If Application.WorksheetFunction.CountA(Selection) = 0 Then
Selection.EntireColumn.Delete
Else
ActiveCell.Offset(0, 1).Select
End If
Next k
Cells(1, 1).Select
End Sub

Note:- Workbook containing the above macro is also attached herewith.

Best Regards,

-- 
DILIP KUMAR PANDEY
   MBA-HR,B COM(Hons.),BCA
Mobile: +91 9810929744
dilipan...@gmail.com
dilipan...@yahoo.com
New Delhi - 110062

On 1/23/10, mike <mwillia...@socal.rr.com> wrote:
>
> I'm looking to set up some VBA code to delete blank rows and columns
> that just take up space in spreadsheets that I get from external
> sources.  ie: data is in 1 column(A), rows 1-10, if you place a cursor
> in A1 and hit end down, you go to cell A64000.
>
> So delete all empty columns, then rows, then reset excels last cell to
> whatever it is.
>
> Any ideas on this code?
>
> --
>
> ----------------------------------------------------------------------------------
> Some important links for excel users:
> 1. Follow us on TWITTER for tips tricks and links :
> http://twitter.com/exceldailytip
> 2. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at
> http://www.excelitems.com
> 3. Excel tutorials at http://www.excel-macros.blogspot.com
> 4. Learn VBA Macros at http://www.quickvba.blogspot.com
> 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
>
>
> To post to this group, send email to excel-macros@googlegroups.com
> If you find any spam message in the group, please send an email to:
> Ayush Jain  @ jainayus...@gmail.com
> <><><><><><><><><><><><><><><><><><><><><><>
> HELP US GROW !!
>
> We reach over 6,700 subscribers worldwide and receive many nice notes about
> the learning and support from the group.Let friends and co-workers know they
> can subscribe to group at
> http://groups.google.com/group/excel-macros/subscribe
>

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at 
http://www.excelitems.com
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 

To post to this group, send email to excel-macros@googlegroups.com
If you find any spam message in the group, please send an email to:
Ayush Jain  @ jainayus...@gmail.com
<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!

We reach over 6,700 subscribers worldwide and receive many nice notes about the 
learning and support from the group.Let friends and co-workers know they can 
subscribe to group at http://groups.google.com/group/excel-macros/subscribe

Attachment: Delete Blank RC - By DILipandey.xls
Description: MS-Excel spreadsheet

Reply via email to