ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro for copying entire raw (https://www.excelbanter.com/excel-programming/282170-macro-copying-entire-raw.html)

Mac[_5_]

Macro for copying entire raw
 
How can I code a VBA macro to copy entire raw of a perticuler text in column B and paste in the sheet named Output? I mean macro should filterout the raws of a name say mac and then copy only that filtered raw and paste to the sheet named mac

Any help is appreciated
Thanks.

Tom Ogilvy

Macro for copying entire raw
 
Dim rng as Range
set rng = cells.Find("mac")
if not rng is nothing then
rng.EntireRow.copy Destination:=worksheets("Output"). _
Cells(rows.count,1).End(xlup)(2)
end if

If you want to copy it to Mac instead of output, then change output to mac

If you want to look in only one column, then change cells to columns(3) for
example.

--
regards,
Tom Ogilvy

Mac wrote in message
...
How can I code a VBA macro to copy entire raw of a perticuler text in

column B and paste in the sheet named Output? I mean macro should filterout
the raws of a name say mac and then copy only that filtered raw and paste to
the sheet named mac.

Any help is appreciated.
Thanks.




Mac[_5_]

Macro for copying entire raw
 
Thanks Tom for your superfast response. I could not imagine that somebody can be so fast atleast in helping others.
There are two problems in the code.
1. Macro should go through all the raws in the sheet, search for the name1 in col B and all the raws having name1 in col B
to be copied in sheet already there in that name.
2. Then macro will search for the next name in col B, anain copy the raws having that name in col B in the sheet already there
in that name.
3. Simmilarly it should search for all the names in the col B and copy it to the sheet already there in that name.

Pl note that the col B can have the same names repeated many times( This is name of our salesman)
I tried to modify your code to get the above result but failed to assign the cell content to the destination.
Request a bit more help please.

Thanks again,
Mac.


----- Tom Ogilvy wrote: -----

Dim rng as Range
set rng = cells.Find("mac")
if not rng is nothing then
rng.EntireRow.copy Destination:=worksheets("Output"). _
Cells(rows.count,1).End(xlup)(2)
end if

If you want to copy it to Mac instead of output, then change output to mac

If you want to look in only one column, then change cells to columns(3) for
example.

--
regards,
Tom Ogilvy

Mac wrote in message
...
How can I code a VBA macro to copy entire raw of a perticuler text in

column B and paste in the sheet named Output? I mean macro should filterout
the raws of a name say mac and then copy only that filtered raw and paste to
the sheet named mac.
Any help is appreciated.

Thanks.





Dave Peterson[_3_]

Macro for copying entire raw
 
You may want to look at Debra Dalgleish's site:

http://www.contextures.com/excelfiles.html

There are a couple of files you may want to steal from:

Create New Sheets from Filtered List -- uses an Advanced Filter to create
separate sheet of orders for each sales rep visible in a filtered list; macro
automates the filter. AdvFilterRepFiltered.xls 35 kb

Update Sheets from Master -- uses an Advanced Filter to send data from
Master sheet to individual worksheets -- replaces old data with current.
AdvFilterCity.xls 55 kb

Mac wrote:

Thanks Tom for your superfast response. I could not imagine that somebody can be so fast atleast in helping others.
There are two problems in the code.
1. Macro should go through all the raws in the sheet, search for the name1 in col B and all the raws having name1 in col B
to be copied in sheet already there in that name.
2. Then macro will search for the next name in col B, anain copy the raws having that name in col B in the sheet already there
in that name.
3. Simmilarly it should search for all the names in the col B and copy it to the sheet already there in that name.

Pl note that the col B can have the same names repeated many times( This is name of our salesman)
I tried to modify your code to get the above result but failed to assign the cell content to the destination.
Request a bit more help please.

Thanks again,
Mac.

----- Tom Ogilvy wrote: -----

Dim rng as Range
set rng = cells.Find("mac")
if not rng is nothing then
rng.EntireRow.copy Destination:=worksheets("Output"). _
Cells(rows.count,1).End(xlup)(2)
end if

If you want to copy it to Mac instead of output, then change output to mac

If you want to look in only one column, then change cells to columns(3) for
example.

--
regards,
Tom Ogilvy

Mac wrote in message
...
How can I code a VBA macro to copy entire raw of a perticuler text in

column B and paste in the sheet named Output? I mean macro should filterout
the raws of a name say mac and then copy only that filtered raw and paste to
the sheet named mac.
Any help is appreciated.

Thanks.





--

Dave Peterson



All times are GMT +1. The time now is 09:42 AM.

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