Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi guys I am new to VBA and I am trying to write a macro that allows me to search for a certain value in a cell and then delate all the rows above that specific cell. I have written a code to find the specific cell, but how do I find out what row that cell is in so I can delete the ones above it? Is there anyway to store the row number of a selected cell in a variable? Your help would be much appreciated. -- jnasr00 ------------------------------------------------------------------------ jnasr00's Profile: http://www.excelforum.com/member.php...o&userid=28515 View this thread: http://www.excelforum.com/showthread...hreadid=481723 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
It depends on the code you have for finding the cell. If you are
assigning a range object to that cell then: myRange.Row If you are selecting the cell (not recommended in case the value is not found) then: Activecell.Row Hope this helps Rowan jnasr00 wrote: Hi guys I am new to VBA and I am trying to write a macro that allows me to search for a certain value in a cell and then delate all the rows above that specific cell. I have written a code to find the specific cell, but how do I find out what row that cell is in so I can delete the ones above it? Is there anyway to store the row number of a selected cell in a variable? Your help would be much appreciated. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
not sure how you're figuring out where to start, but this would delete the
rows from row 5 to one above where the active cell is Range(Rows(5), ActiveCell.Offset(-1, 0)).Delete -- Gary "jnasr00" wrote in message ... Hi guys I am new to VBA and I am trying to write a macro that allows me to search for a certain value in a cell and then delate all the rows above that specific cell. I have written a code to find the specific cell, but how do I find out what row that cell is in so I can delete the ones above it? Is there anyway to store the row number of a selected cell in a variable? Your help would be much appreciated. -- jnasr00 ------------------------------------------------------------------------ jnasr00's Profile: http://www.excelforum.com/member.php...o&userid=28515 View this thread: http://www.excelforum.com/showthread...hreadid=481723 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
number finding | Excel Discussion (Misc queries) | |||
Finding a row number | Excel Discussion (Misc queries) | |||
Finding number less than 1 | Excel Discussion (Misc queries) | |||
finding a number and the number of times it occurs | Excel Discussion (Misc queries) | |||
Finding MAX number (excluding a particular number) | Excel Programming |