Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Finding a row number


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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default Finding a row number

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Finding a row number

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
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
number finding John Roberts Excel Discussion (Misc queries) 2 May 28th 09 05:19 PM
Finding a row number Farhad Excel Discussion (Misc queries) 5 November 22nd 07 07:39 PM
Finding number less than 1 Sony Excel Discussion (Misc queries) 2 October 27th 06 01:19 AM
finding a number and the number of times it occurs luposlipophobia Excel Discussion (Misc queries) 3 June 22nd 06 03:51 AM
Finding MAX number (excluding a particular number) Johnny[_9_] Excel Programming 1 April 24th 05 12:50 PM


All times are GMT +1. The time now is 11:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"