473,322 Members | 1,268 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Delete an Entire Row in .vbs

I'm hoping this is the right sub-forum to post this question, my apologies if it's not.


The problem I'm having is that I can't get a blank row to be deleted. Below is a section of code where the Selection.EntireRow.Delete should occur.

'-- Loop through to make sure only MS Patches are there. Delete Empty rows
For row = 2 To allRows
allString = xlSReport.Cells(row,2)
If (allString = "") Then
allString.EntireRow.Delete
End If
'Do Nothing
Next
xlSReport.columns(1).Autofit()
xlSReport.columns(2).Autofit()
xlSReport.columns(4).Autofit()
xlSReport.columns(5).Autofit()
Nov 3 '08 #1
1 3242
Stewart Ross
2,545 Expert Mod 2GB
What type is your variable AllString? It looks like it should be a Range object, but if it is you are not using the object Set keyword to set it to the range defined by Cells(row, 2) in your FOR loop - which would normally cause a compiler error.

If it is a string, then you cannot use that string as a range object to delete the row inside your IF - and again, trying to do so should throw up a compiler error.

I guess you might have used an untyped variant for AllString - but if you have this will not work either. The EntireRow.Delete method is a property of a range object, and this is what you must supply if you expect it to work.

One way or the other you seem to be using an incorrect type here.

-Stewart
Nov 6 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Pelle | last post by:
Hello all, I have to admit, that the idea that occurred to me recently is weird. It was somehow inspired by the huge response on the "delete operator" thread, but goes into a somewhat different...
14
by: Timothy Madden | last post by:
Hello I have a linked list of object of a class. I thought it would be nice to have the destructor delete the whole list when I delete just the first element. I don't want to recursivly destroy...
9
by: Robert Schneider | last post by:
Hi to all, I don't understand that: I try to delete a record via JDBC. But I always get the error SQL7008 with the error code 3. It seems that this has something to do with journaling, since the...
4
by: Susan Bricker | last post by:
I have a command button on a form that is supposed to Delete the record being displayed. The record is displayed one to a form. The form is not a Pop-Up nor is it Modal. Tracing the btnDelete...
3
by: alex | last post by:
Hi, is there a way to prevent users from a) selecting single rows and deleting them b) select the entire table and delete it with CTRL+A then Delete Also, is there a faster way to copy the a...
6
by: Karl Richards | last post by:
I am attempting to delete duplicate rows in a spreadsheet using the Excel object. Does anyone have any idea how to do this? I've looked everywhere that I can find on the Web and have not been...
9
by: Juergen Huber | last post by:
hello, i am a dummy user in python and new in this programming language and so there will be questions, that´s for you no problem! i never have before programmed in any language! sorry for this!...
6
by: polocar | last post by:
Hi, I'm writing a program in Visual C# 2005 Professional Edition. This program connects to a SQL Server 2005 database called "Generations" (in which there is only one table, called...
15
by: LuB | last post by:
I am constantly creating and destroying a singular object used within a class I wrote. To save a bit of time, I am considering using 'placement new'. I guess we could also debate this decision -...
4
by: =?Utf-8?B?UmljaA==?= | last post by:
On a form - I have a datagridview which is docked to the entire form. The datagridview allows users to Delete and/or Add Rows. On the Form_Load event I Fill the datagridview source table with a...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.