Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Delete Rows based on # of rows (no variable?)

SO frustrated. I'm a very light-weight VBA user. I have a document where I
need to delete several rows at a time, shifting up. Always three rows. I
tried recording this, but it doesn't work that way. I've dug around in Help
until I'm utterly confused as to where to start. I have a workbook with the
steps (what I was given to follow) but I only really need to know about
deleting rows. I think I might be able to figure out the rest. I'll need to
run this same sequence of steps multiple times, but I can figure that out as
well. Thanks to anyone who can help!--
DanaK
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default Delete Rows based on # of rows (no variable?)

This should give u what u need.


Sub tst()
Dim a As String
Dim b As String
Dim c As Integer
Dim d As String
c = 2
Range("a1").Select
Do Until ActiveCell.Value = "done"
If ActiveCell.Value = "x" Then
a = ActiveCell.Address
b = ActiveCell.Offset(c, 0).Address
d = a & ":" & b
Range(d).Select
Selection.EntireRow.Delete
End If
ActiveCell.Offset(1, 0).Activate
Loop
End Sub


"DanaK" wrote:

SO frustrated. I'm a very light-weight VBA user. I have a document where I
need to delete several rows at a time, shifting up. Always three rows. I
tried recording this, but it doesn't work that way. I've dug around in Help
until I'm utterly confused as to where to start. I have a workbook with the
steps (what I was given to follow) but I only really need to know about
deleting rows. I think I might be able to figure out the rest. I'll need to
run this same sequence of steps multiple times, but I can figure that out as
well. Thanks to anyone who can help!--
DanaK

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Delete Rows based on # of rows (no variable?)

Thanks! I do have a question. Do I need to modify something? When I start it,
it runs all the way to the bottom & then I get an Application Defined or
Object error at line ActiveCell.Offset(1, 0).Activate. First row to delete
will be 8 & the last would be 24.
--
DanaK


"DanaK" wrote:

SO frustrated. I'm a very light-weight VBA user. I have a document where I
need to delete several rows at a time, shifting up. Always three rows. I
tried recording this, but it doesn't work that way. I've dug around in Help
until I'm utterly confused as to where to start. I have a workbook with the
steps (what I was given to follow) but I only really need to know about
deleting rows. I think I might be able to figure out the rest. I'll need to
run this same sequence of steps multiple times, but I can figure that out as
well. Thanks to anyone who can help!--
DanaK

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default Delete Rows based on # of rows (no variable?)

I set the loop to end when the activecell is equal to "done" -- you can
either type the word done in column A at the bottom of your spreadsheet or
change the word done in the do statement to something that works for u.



"DanaK" wrote:

SO frustrated. I'm a very light-weight VBA user. I have a document where I
need to delete several rows at a time, shifting up. Always three rows. I
tried recording this, but it doesn't work that way. I've dug around in Help
until I'm utterly confused as to where to start. I have a workbook with the
steps (what I was given to follow) but I only really need to know about
deleting rows. I think I might be able to figure out the rest. I'll need to
run this same sequence of steps multiple times, but I can figure that out as
well. Thanks to anyone who can help!--
DanaK

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Delete Rows based on # of rows (no variable?)

I typed done to end the sheet & that stopped it from running to the bottom,
but it doesn't delete any rows. It just drops down to the cell with done. Is
there something else I'm not doing?
DanaK


"dmoney" wrote:

I set the loop to end when the activecell is equal to "done" -- you can
either type the word done in column A at the bottom of your spreadsheet or
change the word done in the do statement to something that works for u.



"DanaK" wrote:

SO frustrated. I'm a very light-weight VBA user. I have a document where I
need to delete several rows at a time, shifting up. Always three rows. I
tried recording this, but it doesn't work that way. I've dug around in Help
until I'm utterly confused as to where to start. I have a workbook with the
steps (what I was given to follow) but I only really need to know about
deleting rows. I think I might be able to figure out the rest. I'll need to
run this same sequence of steps multiple times, but I can figure that out as
well. Thanks to anyone who can help!--
DanaK



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default Delete Rows based on # of rows (no variable?)

look in the code -- there is a line that defines what it is looking for to
delete. in this case, i put in an x -- you can change that to meet what you
need.


"DanaK" wrote:

I typed done to end the sheet & that stopped it from running to the bottom,
but it doesn't delete any rows. It just drops down to the cell with done. Is
there something else I'm not doing?
DanaK


"dmoney" wrote:

I set the loop to end when the activecell is equal to "done" -- you can
either type the word done in column A at the bottom of your spreadsheet or
change the word done in the do statement to something that works for u.



"DanaK" wrote:

SO frustrated. I'm a very light-weight VBA user. I have a document where I
need to delete several rows at a time, shifting up. Always three rows. I
tried recording this, but it doesn't work that way. I've dug around in Help
until I'm utterly confused as to where to start. I have a workbook with the
steps (what I was given to follow) but I only really need to know about
deleting rows. I think I might be able to figure out the rest. I'll need to
run this same sequence of steps multiple times, but I can figure that out as
well. Thanks to anyone who can help!--
DanaK

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Delete Rows based on # of rows (no variable?)

Sorry for the delay- had an out of town trip. I think I got it. It appears to
be doing what I needed it to. I really appreciate you being so patient! I
felt like 5 year old, what now? Why this? Hopefully more of this stuff will
sink in....Thank you!
--
DanaK


"dmoney" wrote:


DanaK - Feel free to email me at and attach your file
and I will see if I can better understand what you are trying to accomplish.
I am sure that we can get it done.

regards,
dmoney

"DanaK" wrote:

I typed done to end the sheet & that stopped it from running to the bottom,
but it doesn't delete any rows. It just drops down to the cell with done. Is
there something else I'm not doing?
DanaK


"dmoney" wrote:

I set the loop to end when the activecell is equal to "done" -- you can
either type the word done in column A at the bottom of your spreadsheet or
change the word done in the do statement to something that works for u.



"DanaK" wrote:

SO frustrated. I'm a very light-weight VBA user. I have a document where I
need to delete several rows at a time, shifting up. Always three rows. I
tried recording this, but it doesn't work that way. I've dug around in Help
until I'm utterly confused as to where to start. I have a workbook with the
steps (what I was given to follow) but I only really need to know about
deleting rows. I think I might be able to figure out the rest. I'll need to
run this same sequence of steps multiple times, but I can figure that out as
well. Thanks to anyone who can help!--
DanaK

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
Delete Rows based on value Sabosis Excel Worksheet Functions 4 October 28th 08 11:21 PM
Variable criteria to delete rows Jeff Bertram Excel Programming 18 July 21st 08 07:30 PM
Delete variable # of rows depending on conditions Pman Excel Programming 5 September 27th 07 03:27 PM
Delete rows based on value... Gordon[_2_] Excel Programming 3 September 15th 06 09:14 PM
Delete all Rows in a Variable Range John[_78_] Excel Programming 3 June 30th 04 06:13 PM


All times are GMT +1. The time now is 12:22 AM.

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"