Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Wrong Number of Arguments or Invalid Property Assignment???

Hi everyone! When I have just two cells listed to .clear, this works.
When I add all the cells I need to be cleared, I get the Compile Error
"Wrong Number of Arguments or Invalid Property Assignment" Should I be
using something else other than Cells???

Sub RemoveStuff()
Dim i As Long
i = 2
While Not IsEmpty(Cells(i, 4))
If Cells(i, 4).Value = Cells(i - 1, 4).Value And Cells(i, 8) <=
0 Then
Range(Cells(i, 19), Cells(i, 20), Cells(i, 21), Cells(i,
22), Cells(i, 23), Cells(i, 24), Cells(i, 25), Cells(i, 26), Cells(i,
27), Cells(i, 28), Cells(i, 29), Cells(i, 30), Cells(i, 31), Cells(i,
32), Cells(i, 33), Cells(i, 34), Cells(i, 35), Cells(i, 36), Cells(i,
37), Cells(i, 38)).Clear
ElseIf Cells(i, 4).Value = Cells(i + 1, 4).Value And Cells(i,
8) <= 0 Then _
Range(Cells(i, 19), Cells(i, 20), Cells(i, 21), Cells(i,
22), Cells(i, 23), Cells(i, 24), Cells(i, 25), Cells(i, 26), Cells(i,
27), Cells(i, 28), Cells(i, 29), Cells(i, 30), Cells(i, 31), Cells(i,
32), Cells(i, 33), Cells(i, 34), Cells(i, 35), Cells(i, 36), Cells(i,
37), Cells(i, 38)).Clear
End If
i = i + 1
Wend

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Wrong Number of Arguments or Invalid Property Assignment???

Cells(i, 19).resize(20).Clear

is a lot easier.

--
Jim
"tbassngal" wrote in message
ups.com...
| Hi everyone! When I have just two cells listed to .clear, this works.
| When I add all the cells I need to be cleared, I get the Compile Error
| "Wrong Number of Arguments or Invalid Property Assignment" Should I be
| using something else other than Cells???
|
| Sub RemoveStuff()
| Dim i As Long
| i = 2
| While Not IsEmpty(Cells(i, 4))
| If Cells(i, 4).Value = Cells(i - 1, 4).Value And Cells(i, 8) <=
| 0 Then
| Range(Cells(i, 19), Cells(i, 20), Cells(i, 21), Cells(i,
| 22), Cells(i, 23), Cells(i, 24), Cells(i, 25), Cells(i, 26), Cells(i,
| 27), Cells(i, 28), Cells(i, 29), Cells(i, 30), Cells(i, 31), Cells(i,
| 32), Cells(i, 33), Cells(i, 34), Cells(i, 35), Cells(i, 36), Cells(i,
| 37), Cells(i, 38)).Clear
| ElseIf Cells(i, 4).Value = Cells(i + 1, 4).Value And Cells(i,
| 8) <= 0 Then _
| Range(Cells(i, 19), Cells(i, 20), Cells(i, 21), Cells(i,
| 22), Cells(i, 23), Cells(i, 24), Cells(i, 25), Cells(i, 26), Cells(i,
| 27), Cells(i, 28), Cells(i, 29), Cells(i, 30), Cells(i, 31), Cells(i,
| 32), Cells(i, 33), Cells(i, 34), Cells(i, 35), Cells(i, 36), Cells(i,
| 37), Cells(i, 38)).Clear
| End If
| i = i + 1
| Wend
|
| End Sub
|


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Wrong Number of Arguments or Invalid Property Assignment???

So would it be like:

Cells(i,
19).resize(20).resize(21).resize(22).resize(23).re size(24).Clear

???

This doesn't make sense to me... I've never used this before.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Wrong Number of Arguments or Invalid Property Assignment???

Just replace your entire .Clear statement with mine. And check out Resize
in Help.

--
Jim
"tbassngal" wrote in message
oups.com...
| So would it be like:
|
| Cells(i,
| 19).resize(20).resize(21).resize(22).resize(23).re size(24).Clear
|
| ???
|
| This doesn't make sense to me... I've never used this before.
|


Reply
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
Compile Error: Wrong arguments or Invalid property Brent E Excel Discussion (Misc queries) 3 May 1st 07 07:11 PM
Compile Error - Wrong number of arguements or invalid property ass James T Excel Programming 2 November 18th 05 07:46 AM
Wrong number of arguments - Help Les Stout[_2_] Excel Programming 6 October 11th 05 08:22 PM
Wrong number of Arguments or Invalid property assignment Turin[_2_] Excel Programming 1 July 17th 05 09:52 PM


All times are GMT +1. The time now is 04:22 PM.

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

About Us

"It's about Microsoft Excel"