LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Finding ranges in an array, cut and paste also.

Just some thoughts:


I don't see where the heading is copied as specified by the OP.
Might want to change

Sheets("Sheet2").Range("a2:h" & m).Copy ActiveSheet.Range("A2")

to
Sheets("Sheet2").Range("a1:h" & m).Copy ActiveSheet.Range("A1")



IF he is looking for 32 and it isn't found in the data it would cause an
error? The error isn't handled gracefully and would just puke all over the
screen.


If he has option explict at the top of the module, your code gives me an
error. Several in fact. (same with mine).


Sub testIt()
Dim n as Long
Dim m as Long
Dim rng as Range

n = 100
Set rng = Sheets("Sheet2").Range("a2:H" & n).Find(32)
if not rng is nothing then
m = rng.Row
Worksheets.Add
Sheets("Sheet2").Range("a1:h" & m).Copy ActiveSheet.Range("A1")
End if
End Sub



--
Regards,
Tom Ogilvy







"Alan Beban" wrote in message
...
I assumed your data is in A2:H100, and that you were looking for 32 in
Column 2:

Sub testIt()
n = 100
Set rng = Sheets("Sheet2").Range("a2:H" & n)
m = rng.Columns(2).Find(32).Row
Worksheets.Add
Sheets("Sheet2").Range("a2:h" & m).Copy ActiveSheet.Range("A2")
End Sub

Alan Beban

Chuck Mryglot wrote:
Hi Alan.
I have 8 columns of data...with a heading at the top of each
column...e.g. row 1 is headings and data starts in row 2. The data is
sorted. I need to look down one of the columns until I find a
particular integer value. Then I need to copy everything from row 2 down
to the row in which I found the integer I was looking for....call it row
n .....and past the 8 columns (with headings) from row 1 to row m onto a
new sheet.
chuck


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!




 
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
Array formula: how to join 2 ranges together to form one array? Rich_84 Excel Worksheet Functions 2 April 1st 09 06:38 PM
Finding duplicates in distinct ranges... Mac Excel Worksheet Functions 2 November 5th 07 09:19 PM
Finding specific text in ranges timmulla Excel Discussion (Misc queries) 3 January 24th 07 06:01 PM
Finding max from different ranges of data owen080808 Excel Discussion (Misc queries) 2 April 5th 06 11:00 AM
variant array containing cel adresses convert to actual ranges-array Peter[_21_] Excel Programming 5 December 10th 03 09:50 PM


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