AnsweredAssumed Answered

FW: vrf Need to delete row in excel

Question asked by VRFuser on Jul 17, 2008
Yes, if you really want to delete them. Here's a sample code for VBA macro. Just call it in vee.

 

With the macros below you can delete all empty rows or columns within a worksheet range.

You can also delete every n-th row or column. The macros will run faster if you add

Application.ScreenUpdating = False to the code.

 

Sub DeleteEmptyRows(DeleteRange As Range)

' Deletes all empty rows in DeleteRange

' Example: DeleteEmptyRows Selection

' Example: DeleteEmptyRows Range("A1:D100")

Dim rCount As Long, r As Long

    If DeleteRange Is Nothing Then Exit Sub

    If DeleteRange.Areas.Count > 1 Then Exit Sub

    With DeleteRange

        rCount = .Rows.Count

        For r = rCount To 1 Step -1

            If Application.CountA(.Rows(r)) = 0 Then

                .Rows(r).EntireRow.Delete

            End If

        Next r

    End With

End Sub

 

 

Sub DeleteEmptyColumns(DeleteRange As Range)

' Deletes all empty columns in DeleteRange

' Example: DeleteEmptyColumns Selection

' Example: DeleteEmptyColumns Range("A1:Z1")

Dim cCount As Integer, c As Integer

    If DeleteRange Is Nothing Then Exit Sub

    If DeleteRange.Areas.Count > 1 Then Exit Sub

    With DeleteRange

        cCount = .Columns.Count

        For c = cCount To 1 Step -1

            If Application.CountA(.Columns(c)) = 0 Then

                .Columns(c).EntireColumn.Delete

            End If

        Next c

    End With

End Sub

 

 

Sub DeleteEveryNthRow(DeleteRange As Range, N As Integer)

' Deletes every n-th row in DeleteRange

' Example: DeleteEveryNthRow Selection,2

' Example: DeleteEveryNthRow Range("A1:D100"),4

Dim rCount As Long, r As Long

    If DeleteRange Is Nothing Then Exit Sub

    If DeleteRange.Areas.Count > 1 Then Exit Sub

    If N < 2 Then Exit Sub

    With DeleteRange

        rCount = .Rows.Count

        For r = N To rCount Step N - 1

            .Rows(r).EntireRow.Delete

        Next r

    End With

End Sub

 

 

Sub DeleteEveryNthColumn(DeleteRange As Range, N As Integer)

' Deletes every n-th column in DeleteRange

' Example: DeleteEveryNthColumn Selection,2

' Example: DeleteEveryNthColumn Range("A1:D100"),4

Dim cCount As Long, c As Long

    If DeleteRange Is Nothing Then Exit Sub

    If DeleteRange.Areas.Count > 1 Then Exit Sub

    If N < 2 Then Exit Sub

    With DeleteRange

        cCount = .Columns.Count

        For c = N To cCount Step N - 1

            .Columns(c).EntireColumn.Delete

        Next c

    End With

End Sub

 

 

Ann Santonia

SOFTWARE SPECIALIST

                                                                               

Ark One Solutions, Inc.

TELEPHONE NUMBER: +632 842 9090 / +632 842 9191

FAX NUMBER: +632 842 9292                 

MOBILE NUMBER: +63 905 222 1517

 

Unit 405 Park Trade Bldg.  Investment Drive Madrigal Business Park

Ayala Alabang, Muntinlupa City 1781

 

 

-----Original Message-----
From: rpowell@amptechdesign.com [mailto:rpowell@amptechdesign.com]
Sent: Friday, July 18, 2008 5:29 AM
To: VRF
Subject: Re: [vrf] Need to delete row in excel

 

the way I do such things is:

 

use the macro recorder to see how vba does it.

 

Rick Powell

 

----- Original Message -----

From: "Thomas E Daniels" <TDaniels@moreycorp.com>

To: "VRF" <vrf@agilent.com>

Sent: Thursday, July 17, 2008 1:46 PM

Subject: [vrf] Need to delete row in excel

 

 

 

Hi VRF,

 

I'm trying to use vee to open a csv test result file in excel, read some

cells, write some cells, delete some information I don't need, and save the

modified xls file.  This is the first time I have tried to manipulate an

excel spreadsheet with vee, but have managed to get everything working

except for deleting a row from the spreadsheet.

 

Can someone provide an example that will show me how to delete a row in

excel from vee?  I didn't find anything helpful in the excel examples in

vee or the archives.  I'm using vee 7.5

 

Tom Daniels

 

This e-mail, including attachments, may contain information that is

confidential and/or proprietary, and may only be used by the person to whom

this email is addressed. If the recipient of this e-mail is not the intended

recipient or an authorized agent, the reader is hereby notified that any

dissemination, distribution, or copying of this e-mail is prohibited. If

this e-mail has been delivered to you in error, please notify the sender by

replying to this message and deleting this e-mail immediately.

 

 

---

You are currently subscribed to vrf as: rpowell@amptechdesign.com

To subscribe please send an email to: "vrf-request@lists.it.agilent.com"

with the word subscribe in the message body.

To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com".

To send messages to this mailing list,  email "vrf@agilent.com".

If you need help with the mailing list send a message to

"owner-vrf@it.lists.it.agilent.com".

Search the "unofficial vrf archive" at

"http://www.vrfarchive.com/vrf_archive".

Search the Agilent vrf archive at "http://vee.engineering.agilent.com".

 

 

 

---

You are currently subscribed to vrf as: me-ann_santonia@ark-one.com

To subscribe please send an email to: "vrf-request@lists.it.agilent.com" with the word subscribe in the message body.

To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com".

To send messages to this mailing list,  email "vrf@agilent.com". 

If you need help with the mailing list send a message to

"owner-vrf@it.lists.it.agilent.com".

Search the "unofficial vrf archive" at "http://www.vrfarchive.com/vrf_archive".

Search the Agilent vrf archive at "http://vee.engineering.agilent.com".

 

No virus found in this incoming message.

Checked by AVG - http://www.avg.com

Version: 8.0.138 / Virus Database: 270.5.1/1559 - Release Date: 7/17/2008 6:08 PM


---
You are currently subscribed to vrf as: hua_jing@agilent.com
To subscribe please send an email to: "vrf-request@lists.it.agilent.com" with the word subscribe in the message body.
To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com".
To send messages to this mailing list, email "vrf@agilent.com".
If you need help with the mailing list send a message to
"owner-vrf@it.lists.it.agilent.com".
Search the "unofficial vrf archive" at "http://www.vrfarchive.com/vrf_archive".
Search the Agilent vrf archive at "http://vee.engineering.agilent.com".  

Outcomes