Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Zygan
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.excel.misc
kassie
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips
 
Posts: n/a
Default 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
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
Selecting data from different cells for a chart Need Help in DC Charts and Charting in Excel 2 March 7th 06 12:00 AM
checking that cells have a value before the workbook will close kcdonaldson Excel Worksheet Functions 8 December 5th 05 04:57 PM
Auto Selecting Cells Greegan Excel Worksheet Functions 5 November 6th 05 12:45 PM
Selecting & Formatting Columns w/ Merged Cells Lisa Beach New Users to Excel 2 October 10th 05 10:19 PM
Hightlighting crosshairs when selecting cells JCF Excel Discussion (Misc queries) 1 January 11th 05 09:08 PM


All times are GMT +1. The time now is 05:55 PM.

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"