Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc
external usenet poster
 
Posts: 7
Default How to subtract some rows from a range

I invoke the UsedRange and get the range as A14:B55 but I want to
subtract the first 5 rows from this used range how can I remove the
rows A14:B20 from the above range.

Thanks
Simon
  #2   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc
external usenet poster
 
Posts: 968
Default How to subtract some rows from a range

dim oUsed as range

set oUsed=activesheet.usedrange
set oUsed=oUsed.resize(oused.rows.count-5,2)
set oUsed=oUsed.offset(5,0)


regards
Charles
______________________
Decision Models
FastExcel Version 2 now available.
www.DecisionModels.com/FxlV2WhatsNew.htm

"Simon Lenn" wrote in message
om...
I invoke the UsedRange and get the range as A14:B55 but I want to
subtract the first 5 rows from this used range how can I remove the
rows A14:B20 from the above range.

Thanks
Simon



  #3   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc
external usenet poster
 
Posts: 3,885
Default How to subtract some rows from a range

Hi Simon
Not sure as A14:B20 are more than 5 rows (7 rows) but try
sub foo()
dim rng as range
Dim rng_reduced as range
dim last_row as long
Dim last_column as integer
set rng = ActiveSheet.UsedRange

last_row = rng.rows.count + rng.row -1
last_column = rng.columns.count + rng.column - 1
set rng_reduced =
range(cells(rng.row+5,rng.column),cells(last_row,l ast_column))
rng_reduced.select
end sub


--
Regards
Frank Kabel
Frankfurt, Germany

Simon Lenn wrote:
I invoke the UsedRange and get the range as A14:B55 but I want to
subtract the first 5 rows from this used range how can I remove the
rows A14:B20 from the above range.

Thanks
Simon


  #4   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc
external usenet poster
 
Posts: 3,885
Default How to subtract some rows from a range

Hi
use Charles approach, definetly better :-)

--
Regards
Frank Kabel
Frankfurt, Germany

Frank Kabel wrote:
Hi Simon
Not sure as A14:B20 are more than 5 rows (7 rows) but try
sub foo()
dim rng as range
Dim rng_reduced as range
dim last_row as long
Dim last_column as integer
set rng = ActiveSheet.UsedRange

last_row = rng.rows.count + rng.row -1
last_column = rng.columns.count + rng.column - 1
set rng_reduced =
range(cells(rng.row+5,rng.column),cells(last_row,l ast_column))
rng_reduced.select
end sub



Simon Lenn wrote:
I invoke the UsedRange and get the range as A14:B55 but I want to
subtract the first 5 rows from this used range how can I remove the
rows A14:B20 from the above range.

Thanks
Simon

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
I want to add or subtract a range of cells wormburner Excel Discussion (Misc queries) 2 May 31st 10 11:03 PM
trying to subtract a range from a cell Angel Woman Excel Worksheet Functions 1 March 26th 09 08:26 PM
subtract a range from an added range Marge Excel Discussion (Misc queries) 2 November 20th 08 10:09 PM
I need to subtract a range of numbers natashac Excel Worksheet Functions 5 October 2nd 07 01:32 AM
Subtract several rows from a total LMB New Users to Excel 5 April 6th 05 10:33 PM


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