Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Selecting offset cells
Just a quick enquiry if some one will thanks. i have a macro that checks the cell value and if the cell value = my value then i want it to delete the whole row However i just need a code that can either derive the row number from and active cell or select and delete a row depending on the active cell thanks -- Zygan ------------------------------------------------------------------------ Zygan's Profile: http://www.excelforum.com/member.php...o&userid=34423 View this thread: http://www.excelforum.com/showthread...hreadid=548234 |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Selecting offset cells
Do you want to delete the row in which the active cell is, or an offset row?
"Zygan" wrote: Just a quick enquiry if some one will thanks. i have a macro that checks the cell value and if the cell value = my value then i want it to delete the whole row However i just need a code that can either derive the row number from and active cell or select and delete a row depending on the active cell thanks -- Zygan ------------------------------------------------------------------------ Zygan's Profile: http://www.excelforum.com/member.php...o&userid=34423 View this thread: http://www.excelforum.com/showthread...hreadid=548234 |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Selecting offset cells
You do't need to check the active cell or select anything, all you need to
do is loop through a range checking it. Also, when deleting, it is always best to work bottom-up. For example, this dchecks column A and deletes the row Sub Test() Dim iLastRow As Long Dim i As Long iLastRow = Cells(Rows.Count, "A").End(xlUp).Row For i = iLastRow To 1 Step -1 If Cells(,"A").Value = "myValue" Then Rows(i).delete End If Next i End Sub -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Zygan" wrote in message ... Just a quick enquiry if some one will thanks. i have a macro that checks the cell value and if the cell value = my value then i want it to delete the whole row However i just need a code that can either derive the row number from and active cell or select and delete a row depending on the active cell thanks -- Zygan ------------------------------------------------------------------------ Zygan's Profile: http://www.excelforum.com/member.php...o&userid=34423 View this thread: http://www.excelforum.com/showthread...hreadid=548234 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Selecting data from different cells for a chart | Charts and Charting in Excel | |||
checking that cells have a value before the workbook will close | Excel Worksheet Functions | |||
Auto Selecting Cells | Excel Worksheet Functions | |||
Selecting & Formatting Columns w/ Merged Cells | New Users to Excel | |||
Hightlighting crosshairs when selecting cells | Excel Discussion (Misc queries) |