ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Use module globally (https://www.excelbanter.com/excel-discussion-misc-queries/261446-use-module-globally.html)

chrissy2391

Use module globally
 
Thanks to the Disscusion groups I found the following to delete blank rows:
Sub macro_der()
Dim i As Long, nLastRow As Long
Set r = ActiveSheet.UsedRange
nLastRow = r.Rows.Count + r.Row - 1
Set r = Rows(nLastRow + 1)
For i = 1 To nLastRow
If Application.CountA(Rows(i)) = 0 Then
Set r = Union(r, Rows(i))
End If
Next
r.Delete
End Sub

It works perfect and I know want to use it in past or future workbooks.
Figured I could copy and paste in the V.B. Editor, but is there
another/easier way to use this globally? Using Excel 2003.
--
Thank you,
Christine

ozgrid.com

Use module globally
 
Create an add-in or store it in your Personal Macro Workbook
http://www.ozgrid.com/VBA/excel-add-in-create.htm



--
Regards
Dave Hawley
www.ozgrid.com
"chrissy2391" wrote in message
...
Thanks to the Disscusion groups I found the following to delete blank
rows:
Sub macro_der()
Dim i As Long, nLastRow As Long
Set r = ActiveSheet.UsedRange
nLastRow = r.Rows.Count + r.Row - 1
Set r = Rows(nLastRow + 1)
For i = 1 To nLastRow
If Application.CountA(Rows(i)) = 0 Then
Set r = Union(r, Rows(i))
End If
Next
r.Delete
End Sub

It works perfect and I know want to use it in past or future workbooks.
Figured I could copy and paste in the V.B. Editor, but is there
another/easier way to use this globally? Using Excel 2003.
--
Thank you,
Christine




All times are GMT +1. The time now is 03:58 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com