Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete Rows based on # of rows (no variable?)
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Delete Rows based on value | Excel Worksheet Functions | |||
Variable criteria to delete rows | Excel Programming | |||
Delete variable # of rows depending on conditions | Excel Programming | |||
Delete rows based on value... | Excel Programming | |||
Delete all Rows in a Variable Range | Excel Programming |