Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Beginning VB 6
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 14th, 2004, 02:19 PM
Registered User
 
Join Date: Oct 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Deleting every other row

I need a macro that will delete every other row in excel. I tried this but no luck. If I just create a macro to delete a row it places a 2 where I have row. I just need to increment the row.

Sub delete()
' delete Macro
'
Dim row, endrow As Integer
row = 2
endrow = 120
'
If row < endrow Then
Rows("row:row").Select
Selection.delete Shift:=xlUp
    row = row + 1

End If

End Sub


Reply With Quote
  #2 (permalink)  
Old December 15th, 2004, 05:20 AM
Registered User
 
Join Date: Feb 2004
Location: , , .
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try this
Sub delete()
' delete Macro
'
Dim row, endrow As Integer
row = 2
endrow = 120
'
Do while row < endrow
Rows("row:row").Select
Selection.delete Shift:=xlUp
    row = row + 2

loop

End Sub
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting a row of an array Singh591 VB.NET 2002/2003 Basics 1 July 23rd, 2007 04:51 PM
deleting row in a datagrid * nightmare :-( chrismogz ADO.NET 4 October 30th, 2006 05:47 PM
Deleting a row in excel sheet using c# livehed General .NET 1 May 17th, 2006 03:02 PM
problem in deleting the row from datagrid swati_joshi ASP.NET 1.0 and 1.1 Basics 10 March 24th, 2006 11:14 AM



All times are GMT -4. The time now is 11:25 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.