Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Selecting a number of rows based on the content


Hi there,

I have managed this before, and subsequently lost the file I was
working on.
Being a total amateur in VBA I'm hoping that someone will be able to
nudge me in the right direction!:


I need to create a range of rows (columns are not required - just
entire rows)

an example logic is:
In Column A, find "Very Likely Projects" - this is the first row in the
range
In Column A, find "Very Likely Projects Total" - this is the last row
in the range.
Select the range.


simple, yes - can I remember hw to do it? no!
any help will be gratefully recieved.

thanks in advance


--
matpj
------------------------------------------------------------------------
matpj's Profile: http://www.excelforum.com/member.php...o&userid=21076
View this thread: http://www.excelforum.com/showthread...hreadid=487981

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Selecting a number of rows based on the content

Here is some code

Const sFind As String = "Very Likely Projects"
Dim rngStart As Range
Dim rngEnd As Range
Dim rngAll As Range

Set rngStart = Columns(1).Find(sFind)
If Not rngStart Is Nothing Then
Set rngEnd = Columns(1).Find(sFind & " Total")
If Not rngEnd Is Nothing Then
Set rngAll = Range(rngStart, rngEnd).EntireRow
MsgBox rngAll.Address
End If
End If


--

HTH

RP
(remove nothere from the email address if mailing direct)


"matpj" wrote in
message ...

Hi there,

I have managed this before, and subsequently lost the file I was
working on.
Being a total amateur in VBA I'm hoping that someone will be able to
nudge me in the right direction!:


I need to create a range of rows (columns are not required - just
entire rows)

an example logic is:
In Column A, find "Very Likely Projects" - this is the first row in the
range
In Column A, find "Very Likely Projects Total" - this is the last row
in the range.
Select the range.


simple, yes - can I remember hw to do it? no!
any help will be gratefully recieved.

thanks in advance


--
matpj
------------------------------------------------------------------------
matpj's Profile:

http://www.excelforum.com/member.php...o&userid=21076
View this thread: http://www.excelforum.com/showthread...hreadid=487981



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Selecting a number of rows based on the content


thanks bob,

that certainly identifies the range and displays it in a box.
I need excel to actually select the rows, as I then need to perform a
cut and then insert in a seperately identified row

do you know how to do this?


--
matpj
------------------------------------------------------------------------
matpj's Profile: http://www.excelforum.com/member.php...o&userid=21076
View this thread: http://www.excelforum.com/showthread...hreadid=487981

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Selecting a number of rows based on the content

Change

MsgBox rngAll.Address

to

rngAll.Select

--

HTH

RP
(remove nothere from the email address if mailing direct)


"matpj" wrote in
message ...

thanks bob,

that certainly identifies the range and displays it in a box.
I need excel to actually select the rows, as I then need to perform a
cut and then insert in a seperately identified row

do you know how to do this?


--
matpj
------------------------------------------------------------------------
matpj's Profile:

http://www.excelforum.com/member.php...o&userid=21076
View this thread: http://www.excelforum.com/showthread...hreadid=487981



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
Copy rows based on cell content billinr Excel Discussion (Misc queries) 2 February 14th 07 08:17 PM
Highting rows based on content of cells Sarah Excel Worksheet Functions 1 January 24th 07 09:44 PM
Delete Rows Based On Content halem2[_39_] Excel Programming 0 October 12th 04 03:27 PM
Delete Rows Based On Content halem2[_38_] Excel Programming 1 October 12th 04 03:16 PM
Hiding rows based on cell content alistair01[_4_] Excel Programming 2 February 3rd 04 01:58 PM


All times are GMT +1. The time now is 12:27 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"