Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,071
Default Dynamic Range Defined by Value of Cell

Change the Offset(,2) to Offset(,31). Otto

"Domenick" wrote in message
...
I my macro, I currently have :

Range("A8:af105").Select
Selection.Copy

Which always selects the same number of rows. I want to change this to
select A8 through af"?" where "?" is the row number of the first row that
has
"TOTAL" in column A.

Is that a little clearer?

"Otto Moehrbach" wrote:

I don't know what you mean by "define a range" but this macro will
provide
the address of the range. HTH Otto
Sub FindTOTAL()
Dim rColA As Range
Dim TotalRng As Range
Set rColA = Range("A2", Range("A" & Rows.Count).End(xlUp))
Set TotalRng = rColA.Find(What:="TOTAL", LookAt:=xlWhole)
Set TotalRng = Range("A2", TotalRng.Offset(, 2))
MsgBox TotalRng.Address
End Sub
"Domenick" wrote in message
...
I am just getting started with dynamic ranges. I have data as follows:

A B C
Product1 qty cost
Product2 qty cost
...
ProductN qty cost
TOTAL qtytot costtot

The number of products varies. There is other data below this that is
unrelated. How can I define a range dynamically that will always
capture
A:C
and as many rows up and including the first time it finds "TOTAL" in
column A?

Any help greatly appreciated.

Thank you.


.

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
Dynamic Chart with Defined names Nils Charts and Charting in Excel 4 November 19th 09 08:57 AM
Data Validation via Dependent List defined by Dynamic Range Lee4 Excel Discussion (Misc queries) 3 August 20th 08 04:45 PM
Dynamic Defined name formula Jim X Excel Discussion (Misc queries) 1 November 30th 06 02:03 AM
dynamic defined ranges Thomas Pike Excel Worksheet Functions 1 September 14th 05 12:29 AM
Comparing a cell result with a pre-defined value range Antony Weldon Excel Worksheet Functions 1 November 23rd 04 11:51 AM


All times are GMT +1. The time now is 04:23 AM.

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"