LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 573
Default Object required?


Rowan Drummond wrote:
Hi Dave

Your problem was that you were setting rngDel and then deleteing all the
columns which meant that rngDel referred to cells that no longer existed.
You were then going on to attempt to add more cells to rngDel. The
easiest fix would be to insert
Set rngDel = nothing
before you start processing the rows.

Regards
Rowan

PS have you tried

Range("G10:L10") = Array("Prov Id", "Lic Cert Type", _
"Effective Date", "Close Date", "Srvc Type", _
"Srvc Appr Status")


Thanks for the info, Rowan. Now it makes sense.
Thanks for the tip on the array, I'm sure I'll be able to use that
soon.


davegb wrote:
Tom Ogilvy wrote:

Union works with rows, columns, single cells, multiple cells, discontiguous
ranges, you name it.

for example, this ran fine for me:

Sub BBCCDD()
Dim rngDel As Range, rCell As Range
Dim rngCol As Range
Dim lRow As Long
lRow = 30
Set rngCol = ActiveSheet.Range("A11:A" & lRow)
For Each rCell In rngCol.Cells
If rCell = "" Then
If rngDel Is Nothing Then
Set rngDel = rCell
Else
Set rngDel = Union(rCell, rngDel)
End If
End If
Next rCell

If rngDel Is Nothing Then
Else
rngDel.EntireRow.Delete
End If

End Sub

Assume you don't have merged cells or anything like that.
--
Regards,
Tom Ogilvy


Thanks for your reply, Tom
No merged cells. But I finally got the macro to run when I changed the
rngDel variable into 2 variables. Used rngDel for the first part of the
macro to remove blank columns, then used rng2Del for the second part of
the macro to remove blank rows. Works fine now. Somehow, I guess, the 2
ranges were being confused, even though it appeared to me that I had
reset the variable at the beginning of the second part of the code.
Thanks to all for the help!


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
R/T 424 - Object required Help Jim May Excel Discussion (Misc queries) 2 April 10th 08 03:01 PM
Object Required aftamath Excel Discussion (Misc queries) 2 March 14th 06 10:19 PM
Object Required teresa Excel Programming 9 May 31st 05 06:21 PM
Object required? Vasant Nanavati Excel Programming 0 May 14th 05 09:38 PM
Object required? Tony Excel Programming 2 March 22nd 05 04:52 PM


All times are GMT +1. The time now is 10:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"