Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 14
Default Copy Rows With Same Value into a new Worksheet

Hey right now I have a huge excel sheet with like 250 columns and
there are about 250 rows but I need the macro to go up to 1500 because
I will be getting more data. In the column "i" I have different
strings such as "Burger King". I need a macro that will copy every row
in the sheet that is the value of Burger King in "i" for example to
its own sheet entitled that value. Can someone help me out please? I
tried a few things I found by searching but they didn't work.

Thank you very much!

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Copy Rows With Same Value into a new Worksheet

DataFilterAutofilter.

Filter for Burger King on column I.

Copy and paste the results to a Burger King sheet.

If you need code for copying, adding a sheet and pasting try Ron de Bruin's site
for methods.

http://www.rondebruin.nl/copy5.htm

More on Copying, Pasting and Merging at Ron's Excel Tips page.

See link when on the above page.


Gord Dibben MS Excel MVP

On 3 Feb 2007 20:05:13 -0800, "tnederlof" wrote:

Hey right now I have a huge excel sheet with like 250 columns and
there are about 250 rows but I need the macro to go up to 1500 because
I will be getting more data. In the column "i" I have different
strings such as "Burger King". I need a macro that will copy every row
in the sheet that is the value of Burger King in "i" for example to
its own sheet entitled that value. Can someone help me out please? I
tried a few things I found by searching but they didn't work.

Thank you very much!


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 14
Default Copy Rows With Same Value into a new Worksheet

On Feb 3, 11:17 pm, Gord Dibben <gorddibbATshawDOTca wrote:
DataFilterAutofilter.

Filter for Burger King on column I.

Copy and paste the results to a Burger King sheet.

If you need code for copying, adding a sheet and pasting try Ron de Bruin's site
for methods.

http://www.rondebruin.nl/copy5.htm

More on Copying, Pasting and Merging at Ron's Excel Tips page.

See link when on the above page.

Hmm I tried those and they would only copy the first row and that is
it.

Gord Dibben MS Excel MVP

On 3 Feb 2007 20:05:13 -0800, "tnederlof" wrote:

Hey right now I have a huge excel sheet with like 250 columns and
there are about 250 rows but I need the macro to go up to 1500 because
I will be getting more data. In the column "i" I have different
strings such as "Burger King". I need a macro that will copy every row
in the sheet that is the value of Burger King in "i" for example to
its own sheet entitled that value. Can someone help me out please? I
tried a few things I found by searching but they didn't work.


Thank you very much!



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,123
Default Copy Rows With Same Value into a new Worksheet

Hi

It use this now
If there is a empty row it not filter all data when you use the AutoFilter example

Set rng = WS.Range("A1").CurrentRegion '<<< Change

You can change it to

Set rng = WS.Range("A1:IV5000")


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"tnederlof" wrote in message ups.com...
On Feb 3, 11:17 pm, Gord Dibben <gorddibbATshawDOTca wrote:
DataFilterAutofilter.

Filter for Burger King on column I.

Copy and paste the results to a Burger King sheet.

If you need code for copying, adding a sheet and pasting try Ron de Bruin's site
for methods.

http://www.rondebruin.nl/copy5.htm

More on Copying, Pasting and Merging at Ron's Excel Tips page.

See link when on the above page.

Hmm I tried those and they would only copy the first row and that is
it.

Gord Dibben MS Excel MVP

On 3 Feb 2007 20:05:13 -0800, "tnederlof" wrote:

Hey right now I have a huge excel sheet with like 250 columns and
there are about 250 rows but I need the macro to go up to 1500 because
I will be getting more data. In the column "i" I have different
strings such as "Burger King". I need a macro that will copy every row
in the sheet that is the value of Burger King in "i" for example to
its own sheet entitled that value. Can someone help me out please? I
tried a few things I found by searching but they didn't work.


Thank you very much!



  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 14
Default Copy Rows With Same Value into a new Worksheet


I just says subscript out of range. Could someone post the script
modifed for burger king on a page called "rawdata" and so that the
value is found in column i? Thanks

On Feb 4, 5:34 am, "Ron de Bruin" wrote:
Hi

It use this now
If there is a empty row it not filter all data when you use the AutoFilter example

Set rng = WS.Range("A1").CurrentRegion '<<< Change

You can change it to

Set rng = WS.Range("A1:IV5000")

--

Regards Ron de Bruinhttp://www.rondebruin.nl/tips.htm

"tnederlof" wrote in oglegroups.com...
On Feb 3, 11:17 pm, Gord Dibben <gorddibbATshawDOTca wrote:
DataFilterAutofilter.


Filter for Burger King on column I.


Copy and paste the results to a Burger King sheet.


If you need code for copying, adding a sheet and pasting try Ron de Bruin's site
for methods.


http://www.rondebruin.nl/copy5.htm


More on Copying, Pasting and Merging at Ron's Excel Tips page.


See link when on the above page.

Hmm I tried those and they would only copy the first row and that is
it.


Gord Dibben MS Excel MVP


On 3 Feb 2007 20:05:13 -0800, "tnederlof" wrote:


Hey right now I have a huge excel sheet with like 250 columns and
there are about 250 rows but I need the macro to go up to 1500 because
I will be getting more data. In the column "i" I have different
strings such as "Burger King". I need a macro that will copy every row
in the sheet that is the value of Burger King in "i" for example to
its own sheet entitled that value. Can someone help me out please? I
tried a few things I found by searching but they didn't work.


Thank you very much!





  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,123
Default Copy Rows With Same Value into a new Worksheet

Try this

Sub Copy_With_AutoFilter1()
Dim WS As Worksheet
Dim WSNew As Worksheet
Dim rng As Range
Dim rng2 As Range
Dim Str As String

Set WS = Sheets("rawdata") '<<< Change
'A1 is the top left cell of your filter range and the header of the first column
Set rng = WS.Range("A1:IV5000")

Str = "Burger King" '<<< Change

'Close AutoFilter first
WS.AutoFilterMode = False

'This example filter on the first column in the range (change the field if needed)
'I change the 1 to the I column = 9
rng.AutoFilter Field:=9, Criteria1:=Str

Set WSNew = Worksheets.Add

WS.AutoFilter.Range.Copy
With WSNew.Range("A1")
' Paste:=8 will copy the columnwidth in Excel 2000 and higher
.PasteSpecial Paste:=8
.PasteSpecial xlPasteValues
.PasteSpecial xlPasteFormats
Application.CutCopyMode = False
.Select
End With

' 'If you want to delete the rows in WS that you copy use this also
' With WS.AutoFilter.Range
' On Error Resume Next
' Set rng2 = .Offset(1, 0).Resize(.Rows.Count - 1, .Columns.Count) _
' .SpecialCells(xlCellTypeVisible)
' On Error GoTo 0
' If Not rng2 Is Nothing Then rng2.EntireRow.Delete
' End With

WS.AutoFilterMode = False

On Error Resume Next
WSNew.Name = Str
If Err.Number 0 Then
MsgBox "Change the name of : " & WSNew.Name & " manually"
Err.Clear
End If
On Error GoTo 0
End Sub




--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"tnederlof" wrote in message oups.com...

I just says subscript out of range. Could someone post the script
modifed for burger king on a page called "rawdata" and so that the
value is found in column i? Thanks

On Feb 4, 5:34 am, "Ron de Bruin" wrote:
Hi

It use this now
If there is a empty row it not filter all data when you use the AutoFilter example

Set rng = WS.Range("A1").CurrentRegion '<<< Change

You can change it to

Set rng = WS.Range("A1:IV5000")

--

Regards Ron de Bruinhttp://www.rondebruin.nl/tips.htm

"tnederlof" wrote in oglegroups.com...
On Feb 3, 11:17 pm, Gord Dibben <gorddibbATshawDOTca wrote:
DataFilterAutofilter.


Filter for Burger King on column I.


Copy and paste the results to a Burger King sheet.


If you need code for copying, adding a sheet and pasting try Ron de Bruin's site
for methods.


http://www.rondebruin.nl/copy5.htm


More on Copying, Pasting and Merging at Ron's Excel Tips page.


See link when on the above page.
Hmm I tried those and they would only copy the first row and that is
it.


Gord Dibben MS Excel MVP


On 3 Feb 2007 20:05:13 -0800, "tnederlof" wrote:


Hey right now I have a huge excel sheet with like 250 columns and
there are about 250 rows but I need the macro to go up to 1500 because
I will be getting more data. In the column "i" I have different
strings such as "Burger King". I need a macro that will copy every row
in the sheet that is the value of Burger King in "i" for example to
its own sheet entitled that value. Can someone help me out please? I
tried a few things I found by searching but they didn't work.


Thank you very much!



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
COUNTIF in between rows Vasilis Tergen Excel Worksheet Functions 20 January 13th 07 10:22 PM
copy from B worksheet to A worksheet with NO repeated data tikchye_oldLearner57 Excel Discussion (Misc queries) 1 September 29th 06 06:56 PM
copy non-consecutive rows confused Excel Discussion (Misc queries) 7 September 16th 06 07:39 AM
Copy worksheet & maintain cell reference across worksheets dingy101 Excel Worksheet Functions 3 January 2nd 06 10:51 AM
Search a worksheet, extract rows using a list from another sheet bobf Excel Discussion (Misc queries) 9 August 31st 05 04:56 AM


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