PC Review


Reply
Thread Tools Rate Thread

Delete Row Sub not working

 
 
=?Utf-8?B?RXhjZWxNb25rZXk=?=
Guest
Posts: n/a
 
      20th Mar 2007
I have a delete row routine which works. Its the First Macro below. I am
trying to make it more modular by making the delete routine a sub that is
called. This is called Second macro below. However its not working. Not
sure if its the way I have dimenionsed my variable A in the second macro or
if its the way I am passing it to the sub.

First Macro
Sub MemoryManager()
Dim UsedRows As Double
Dim LastRow As Double
Dim RowCounter As Double

UsedRows = 5
LastRow = 20

Range(Range("FirstCell").Offset(UsedRows, 0),
Range("FirstCell").Offset(LastRow, 0)).EntireRow.Clear

End Sub

Second Macro
Sub MemoryManager()
Dim UsedRows As Double
Dim LastRow As Double
Dim RowCounter As Double
Dim A As Object

UsedRows = 5
LastRow = 20

Set A = Range("FirstCell")

Call DeleteUnusedRows(A, UsedRows, LastRow)

End Sub

Sub DeleteUnusedRows(X As Range, Y As Double, Z As Double)

Range(Range(X).Offset(Y, 0), Range(X).Offset(Z, 0)).EntireRow.Delete

End Sub

Thanks

EM
 
Reply With Quote
 
 
 
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      20th Mar 2007
Second Macro
Sub MemoryManager()
Dim UsedRows As Double
Dim LastRow As Double
Dim RowCounter As Double
Dim A As Range '<==

UsedRows = 5
LastRow = 20

Set A = Range("FirstCell")

Call DeleteUnusedRows(A, UsedRows, LastRow)

End Sub

Sub DeleteUnusedRows(X As Range, Y As Double, Z As Double)

x.parent.Range(X.Offset(Y, 0), X.Offset(Z, 0)).EntireRow.Delete '<==

End Sub

--
Regards,
Tom Ogilvy

"ExcelMonkey" wrote:

> I have a delete row routine which works. Its the First Macro below. I am
> trying to make it more modular by making the delete routine a sub that is
> called. This is called Second macro below. However its not working. Not
> sure if its the way I have dimenionsed my variable A in the second macro or
> if its the way I am passing it to the sub.
>
> First Macro
> Sub MemoryManager()
> Dim UsedRows As Double
> Dim LastRow As Double
> Dim RowCounter As Double
>
> UsedRows = 5
> LastRow = 20
>
> Range(Range("FirstCell").Offset(UsedRows, 0),
> Range("FirstCell").Offset(LastRow, 0)).EntireRow.Clear
>
> End Sub
>
> Second Macro
> Sub MemoryManager()
> Dim UsedRows As Double
> Dim LastRow As Double
> Dim RowCounter As Double
> Dim A As Object
>
> UsedRows = 5
> LastRow = 20
>
> Set A = Range("FirstCell")
>
> Call DeleteUnusedRows(A, UsedRows, LastRow)
>
> End Sub
>
> Sub DeleteUnusedRows(X As Range, Y As Double, Z As Double)
>
> Range(Range(X).Offset(Y, 0), Range(X).Offset(Z, 0)).EntireRow.Delete
>
> End Sub
>
> Thanks
>
> EM

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete key not working Narelle Microsoft Word Document Management 6 15th Mar 2007 09:06 AM
net use ..... /delete not working Ara Bedrosian Windows XP General 2 12th Jan 2006 01:33 AM
no working Ctrl-Alt-Delete and alway working harddrive Pennym Windows XP Performance 0 16th Nov 2005 05:47 AM
The delete function is not working in outlook xp (delete is 'grey. =?Utf-8?B?ZWhhdXNlcg==?= Microsoft Outlook Discussion 0 6th Apr 2005 05:17 PM
Re: Delete not Working Lanwench [MVP - Exchange] Microsoft Outlook 0 16th Feb 2004 04:45 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:08 PM.