Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Defining Range Question?


How to define the range in vba? I want to search for data in columns "C
to J" from row number 8 until the last row of the active worksheet name
"Record" .

Thanks for helping.


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 620
Default Defining Range Question?

Michael,

cRowLast = Cells(Rows.Count,"C").End(xlUp).Row
Set testRange = Range("C8:C" & cRowLast)

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Michael168" wrote in message
...

How to define the range in vba? I want to search for data in columns "C
to J" from row number 8 until the last row of the active worksheet name
"Record" .

Thanks for helping.


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default Defining Range Question?

One way:

Const FINDSTR As String = "Record"
Dim found As Range
With ActiveSheet
Set found = Intersect(.UsedRange, _
.Range("C8:J" & Rows.Count)).Find( _
What:=FINDSTR, _
LookIn:=xlValues, _
LookAt:=xlWhole, _
MatchCase:=False)
End With
If Not found Is Nothing Then
MsgBox "Found " & FINDSTR & " At " & found.Address
Else
MsgBox "Did not find " & FINDSTR
End If




In article ,
Michael168 wrote:

How to define the range in vba? I want to search for data in columns "C
to J" from row number 8 until the last row of the active worksheet name
"Record" .

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Defining Range Question?

A slightly different interpretation.

Dim rng as Range, rng1 as Range, rng2 as Range
With worksheets("Record")
set rng2 = .Range(.Range("A1"),.UsedRange)
set rng = Intersect(rng2,.Range("C:J"))
set rng = rng.offset(7).Resize(rng.rows.count-7)
End with
set rng1 = rng.Find(What:="Data", . . . )
if not rng1 is nothing then
rng1.Select
End if


Replace "Data" with the string/value you are searching for. Add appropriate
arguments to the Find method.

--
Regards,
Tom Ogilvy

Michael168 wrote in message
...

How to define the range in vba? I want to search for data in columns "C
to J" from row number 8 until the last row of the active worksheet name
"Record" .

Thanks for helping.


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Defining Range Question?


Thank you for your help.

Regards.

J.E. McGimpsey wrote:
*One way:

Const FINDSTR As String = "Record"
Dim found As Range
With ActiveSheet
Set found = Intersect(.UsedRange, _
.Range("C8:J" & Rows.Count)).Find( _
What:=FINDSTR, _
LookIn:=xlValues, _
LookAt:=xlWhole, _
MatchCase:=False)
End With
If Not found Is Nothing Then
MsgBox "Found " & FINDSTR & " At " & found.Address
Else
MsgBox "Did not find " & FINDSTR
End If




In article ,
Michael168 wrote:

How to define the range in vba? I want to search for data in

columns "C
to J" from row number 8 until the last row of the active worksheet

name
"Record" . *



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Defining Range Question?


Thank you for your help.

Regards.

Tom Ogilvy wrote:
*A slightly different interpretation.

Dim rng as Range, rng1 as Range, rng2 as Range
With worksheets("Record")
set rng2 = .Range(.Range("A1"),.UsedRange)
set rng = Intersect(rng2,.Range("C:J"))
set rng = rng.offset(7).Resize(rng.rows.count-7)
End with
set rng1 = rng.Find(What:="Data", . . . )
if not rng1 is nothing then
rng1.Select
End if


Replace "Data" with the string/value you are searching for. Add
appropriate
arguments to the Find method.

--
Regards,
Tom Ogilvy

Michael168 wrote in message
...

How to define the range in vba? I want to search for data in

columns "C
to J" from row number 8 until the last row of the active worksheet

name
"Record" .

Thanks for helping.


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from

http://www.ExcelForum.com/
*



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Defining Range Question?


Thank you for your help.

Regards.

Bob Phillips wrote:
*Michael,

cRowLast = Cells(Rows.Count,"C").End(xlUp).Row
Set testRange = Range("C8:C" & cRowLast)

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Michael168" wrote in
message
...

How to define the range in vba? I want to search for data in

columns "C
to J" from row number 8 until the last row of the active worksheet

name
"Record" .

Thanks for helping.


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from

http://www.ExcelForum.com/
*



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

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
Defining a Range with Criteria Mark R. Excel Discussion (Misc queries) 3 August 19th 08 05:55 PM
Defining Range Name anshu[_2_] Excel Discussion (Misc queries) 2 July 22nd 07 07:30 AM
help defining dynamic range joecrabtree Charts and Charting in Excel 0 December 6th 06 03:33 PM
Defining a range Don Excel Worksheet Functions 1 February 25th 05 03:54 PM
Defining Range MAB[_5_] Excel Programming 2 September 15th 03 02:48 PM


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