ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Use macro to check a range of cells within a row and copy wanted data to new sheet (https://www.excelbanter.com/excel-programming/311888-use-macro-check-range-cells-within-row-copy-wanted-data-new-sheet.html)

busspeed[_3_]

Use macro to check a range of cells within a row and copy wanted data to new sheet
 

I used the other code provided and it worked perfect. I am still goin
to try your code also and see how it works out. Thanks to both of you!

Tom Ogilvy Wrote:
Sub copyData
Dim rng as Range, lRow as Long
With .Columns("D:J")
set rng = .find(84022)
if not rng is nothing then
lRow = rng.row
do
rng.EntireRow.copy Destination:= _
worksheets("Sheet2").Cells(rows.count,1).End(xlup) (2)
set rng = .FindNext(rng)
Loop while rng.row < lRow
End with

End Sub



"busspeed" wrote in message
...

I have a problem and am not very familiar with VBA.
What I need to do is check a row of data one at a time (there ar

about
3000 total rows) looking for a class number (the class numbers ar

in
different columns within the row). When I find that class numbe

within
the row I need to *copy* the row to another sheet. I am simply tryin

to
grab all of the students in certain classes and paste them o

another
sheet.

Here is a sample of the data:
Adams gadams21 041184 84022 84260
Adams hadams4 111591 83772
Adams dadams25 041645 84020 84282
Adams madams3 082981 83969
Adams sadams9 120369 81838 84025 86460

The first column is last name (yes, I have changed the data...non

of
it is sensitive).
The second column is user name.
3rd column is birthday.
Remaining columns are classes they are in (can vary; some can be i

5
classes, some in 1).

Any help would be greatly appreciated.

Thanks,

busspeed


--
busspeed


------------------------------------------------------------------------
busspeed's Profile:

http://www.excelforum.com/member.php...o&userid=14829
View this thread

http://www.excelforum.com/showthread...hreadid=264630


--
busspee
-----------------------------------------------------------------------
busspeed's Profile: http://www.excelforum.com/member.php...fo&userid=1482
View this thread: http://www.excelforum.com/showthread.php?threadid=26463


Tom Ogilvy

Use macro to check a range of cells within a row and copy wanted data to new sheet
 
Don't waste your time. They are essentially the same. Bernies has a few
more bells and whistles.

--
Regards,
Tom Ogilvy

"busspeed" wrote in message
...

I used the other code provided and it worked perfect. I am still going
to try your code also and see how it works out. Thanks to both of you!

Tom Ogilvy Wrote:
Sub copyData
Dim rng as Range, lRow as Long
With .Columns("D:J")
set rng = .find(84022)
if not rng is nothing then
lRow = rng.row
do
rng.EntireRow.copy Destination:= _
worksheets("Sheet2").Cells(rows.count,1).End(xlup) (2)
set rng = .FindNext(rng)
Loop while rng.row < lRow
End with

End Sub



"busspeed" wrote in message
...

I have a problem and am not very familiar with VBA.
What I need to do is check a row of data one at a time (there are

about
3000 total rows) looking for a class number (the class numbers are

in
different columns within the row). When I find that class number

within
the row I need to *copy* the row to another sheet. I am simply trying

to
grab all of the students in certain classes and paste them on

another
sheet.

Here is a sample of the data:
Adams gadams21 041184 84022 84260
Adams hadams4 111591 83772
Adams dadams25 041645 84020 84282
Adams madams3 082981 83969
Adams sadams9 120369 81838 84025 86460

The first column is last name (yes, I have changed the data...none

of
it is sensitive).
The second column is user name.
3rd column is birthday.
Remaining columns are classes they are in (can vary; some can be in

5
classes, some in 1).

Any help would be greatly appreciated.

Thanks,

busspeed


--
busspeed

------------------------------------------------------------------------
busspeed's Profile:

http://www.excelforum.com/member.php...o&userid=14829
View this thread:

http://www.excelforum.com/showthread...hreadid=264630



--
busspeed
------------------------------------------------------------------------
busspeed's Profile:

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





All times are GMT +1. The time now is 02:56 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com