Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,101
Default Moving Info from onw sheet to another

Hi All,
I am trying to use 1 sheet for my data storage then sort that info to
another sheet that looks only for a value I am looking for. Here is a example
of what I am looking at.

Flt Dept Dest Equip Freq Pier
639 0625 SJU 757 D 3
1487 0645 ORD/RNO 757 D 13
404 0650 MCO A300 D 14
1114 0650 LGA 757 D 2
377 0700 PAP A300 D 13

Now what I need to find out is what is the COMMAND that will allow excel
to look for the data such as pier 13 and transfer the info from that line
(i.e 1487 0650 LGA 757 D 13) and move it to another sheet that is only
looking
for the pier 13 value. Not sure if anyone can help

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 897
Default Moving Info from onw sheet to another

If you were looking for a VBA solution, you could do an autofilter on
the data, then copy the visible rows to another worksheet. For
example,

Sub autofiltvisibleandcopytonewwkbk()

Dim rng As Excel.Range
Dim X As Excel.Workbook

Set rng = ActiveSheet.UsedRange.Rows

With rng
.AutoFilter Field:=6, Criteria1:="=13"
End With

With ActiveSheet.AutoFilter.Range
On Error Resume Next
Set rng = .Resize(.Rows.count -
1, .Columns.count).SpecialCells(xlCellTypeVisible)
On Error GoTo 0
End With

Set X = Workbooks.Add

rng.Copy X.Sheets(1).Range("A1")

End Sub


HTH,
JP



On Jan 9, 11:47*am, Mike wrote:
Hi All,
I am trying to use 1 sheet for my data storage then sort that info to
another sheet that looks only for a value I am looking for. Here is a example
of what I am looking at.

Flt * * Dept * *Dest * *Equip * Freq * *Pier
639 * * 0625 * *SJU * * 757 * * D * * * 3
1487 * *0645 * *ORD/RNO 757 * * D * * * 13
404 * * 0650 * *MCO * * A300 * *D * * * 14
1114 * *0650 * *LGA * * 757 * * D * * * 2
377 * * 0700 * *PAP * * A300 * *D * * * 13

Now what I need to find out is what is the COMMAND that will allow excel
to look for the data such as pier 13 and transfer the info from that line
(i.e 1487 0650 LGA *757 D 13) and move it to another sheet that is only
looking
for the pier 13 value. Not sure if anyone can help


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 897
Default Moving Info from onw sheet to another

Sorry I just realized you were asking for a new sheet, not a new
workbook. You could simply change "Set X = Workbooks.Add" to add a
sheet instead of a workbook, Dim X as Excel.Sheet instead, and change
the copy line to "rng.Copy X..Range("A1")" and it should still work.

HTH,
JP

On Jan 9, 12:04*pm, JP wrote:

Sub autofiltvisibleandcopytonewwkbk()

Dim rng As Excel.Range
Dim X As Excel.Workbook

Set rng = ActiveSheet.UsedRange.Rows

With rng
* * .AutoFilter Field:=6, Criteria1:="=13"
End With

With ActiveSheet.AutoFilter.Range
On Error Resume Next
* * Set rng = .Resize(.Rows.count -
1, .Columns.count).SpecialCells(xlCellTypeVisible)
On Error GoTo 0
End With

Set X = Workbooks.Add

rng.Copy X.Sheets(1).Range("A1")

End Sub

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,101
Default Moving Info from onw sheet to another

Thanks JP
Never worte in VBE before but will give it a try...

"JP" wrote:

If you were looking for a VBA solution, you could do an autofilter on
the data, then copy the visible rows to another worksheet. For
example,

Sub autofiltvisibleandcopytonewwkbk()

Dim rng As Excel.Range
Dim X As Excel.Workbook

Set rng = ActiveSheet.UsedRange.Rows

With rng
.AutoFilter Field:=6, Criteria1:="=13"
End With

With ActiveSheet.AutoFilter.Range
On Error Resume Next
Set rng = .Resize(.Rows.count -
1, .Columns.count).SpecialCells(xlCellTypeVisible)
On Error GoTo 0
End With

Set X = Workbooks.Add

rng.Copy X.Sheets(1).Range("A1")

End Sub


HTH,
JP



On Jan 9, 11:47 am, Mike wrote:
Hi All,
I am trying to use 1 sheet for my data storage then sort that info to
another sheet that looks only for a value I am looking for. Here is a example
of what I am looking at.

Flt Dept Dest Equip Freq Pier
639 0625 SJU 757 D 3
1487 0645 ORD/RNO 757 D 13
404 0650 MCO A300 D 14
1114 0650 LGA 757 D 2
377 0700 PAP A300 D 13

Now what I need to find out is what is the COMMAND that will allow excel
to look for the data such as pier 13 and transfer the info from that line
(i.e 1487 0650 LGA 757 D 13) and move it to another sheet that is only
looking
for the pier 13 value. Not sure if anyone can help



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 897
Default Moving Info from onw sheet to another

Check out this site for help on how to use:

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


HTH,
JP

On Jan 9, 12:43*pm, Mike wrote:
Thanks JP
Never worte in VBE before but will give it a try...





  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,101
Default Moving Info from onw sheet to another

Ok Now I think I am getting it. But I I keep getting a compile error wher it
says
Set rng = .resize ( .Rows.count - 1, .colums.count) any help there?

"JP" wrote:

Sorry I just realized you were asking for a new sheet, not a new
workbook. You could simply change "Set X = Workbooks.Add" to add a
sheet instead of a workbook, Dim X as Excel.Sheet instead, and change
the copy line to "rng.Copy X..Range("A1")" and it should still work.

HTH,
JP

On Jan 9, 12:04 pm, JP wrote:

Sub autofiltvisibleandcopytonewwkbk()

Dim rng As Excel.Range
Dim X As Excel.Workbook

Set rng = ActiveSheet.UsedRange.Rows

With rng
.AutoFilter Field:=6, Criteria1:="=13"
End With

With ActiveSheet.AutoFilter.Range
On Error Resume Next
Set rng = .Resize(.Rows.count -
1, .Columns.count).SpecialCells(xlCellTypeVisible)
On Error GoTo 0
End With

Set X = Workbooks.Add

rng.Copy X.Sheets(1).Range("A1")

End Sub


  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Moving Info from onw sheet to another

Mike

That line is part of the next line........wordwrap gotcha.

Set rng = .Resize(.Rows.Count - 1, _
.Columns.Count).SpecialCells(xlCellTypeVisible)

Note I have added the underscore which is a line-continuation character.


Gord Dibben MS Excel MVP

On Wed, 9 Jan 2008 10:31:03 -0800, Mike wrote:

Ok Now I think I am getting it. But I I keep getting a compile error wher it
says
Set rng = .resize ( .Rows.count - 1, .colums.count) any help there?

"JP" wrote:

Sorry I just realized you were asking for a new sheet, not a new
workbook. You could simply change "Set X = Workbooks.Add" to add a
sheet instead of a workbook, Dim X as Excel.Sheet instead, and change
the copy line to "rng.Copy X..Range("A1")" and it should still work.

HTH,
JP

On Jan 9, 12:04 pm, JP wrote:

Sub autofiltvisibleandcopytonewwkbk()

Dim rng As Excel.Range
Dim X As Excel.Workbook

Set rng = ActiveSheet.UsedRange.Rows

With rng
.AutoFilter Field:=6, Criteria1:="=13"
End With

With ActiveSheet.AutoFilter.Range
On Error Resume Next
Set rng = .Resize(.Rows.count -
1, .Columns.count).SpecialCells(xlCellTypeVisible)
On Error GoTo 0
End With

Set X = Workbooks.Add

rng.Copy X.Sheets(1).Range("A1")

End Sub



  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 897
Default Moving Info from onw sheet to another

It might be due to poor wrapping from the ng posting. Remove the "Set
rng" statement and replace it with the one below.

Set rng = .Resize(.Rows.Count - 1, .Columns.Count). _
SpecialCells(xlCellTypeVisible)


--JP


On Jan 9, 1:31*pm, Mike wrote:
Ok Now I think I am getting it. But I I keep getting a compile error wher it
says
Set rng = .resize ( .Rows.count - 1, .colums.count) any help there?



"JP" wrote:
Sorry I just realized you were asking for a new sheet, not a new
workbook. You could simply change "Set X = Workbooks.Add" to add a
sheet instead of a workbook, Dim X as Excel.Sheet instead, and change
the copy line to "rng.Copy X..Range("A1")" and it should still work.


HTH,
JP


On Jan 9, 12:04 pm, JP wrote:


Sub autofiltvisibleandcopytonewwkbk()


Dim rng As Excel.Range
Dim X As Excel.Workbook


Set rng = ActiveSheet.UsedRange.Rows


With rng
* * .AutoFilter Field:=6, Criteria1:="=13"
End With


With ActiveSheet.AutoFilter.Range
On Error Resume Next
* * Set rng = .Resize(.Rows.count -
1, .Columns.count).SpecialCells(xlCellTypeVisible)
On Error GoTo 0
End With


Set X = Workbooks.Add


rng.Copy X.Sheets(1).Range("A1")


End Sub- Hide quoted text -


- Show quoted text -


  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 897
Default Moving Info from onw sheet to another

LOL Gord!!!!

:-)



--JP

On Jan 9, 1:53*pm, Gord Dibben <gorddibbATshawDOTca wrote:
Mike

That line is part of the next line........wordwrap gotcha.

Set rng = .Resize(.Rows.Count - 1, _
* * .Columns.Count).SpecialCells(xlCellTypeVisible)

Note I have added the underscore which is a line-continuation character.

Gord Dibben *MS Excel MVP


  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,101
Default Moving Info from onw sheet to another

Man this is making me CrAzY !!!!! Thank you All for your help. But this WAY
OVER MY HEAD! I have a headache now from trying to get this... LOL I guess I
need to take some course's on MVB and writting macro's.

"Gord Dibben" wrote:

Mike

That line is part of the next line........wordwrap gotcha.

Set rng = .Resize(.Rows.Count - 1, _
.Columns.Count).SpecialCells(xlCellTypeVisible)

Note I have added the underscore which is a line-continuation character.


Gord Dibben MS Excel MVP

On Wed, 9 Jan 2008 10:31:03 -0800, Mike wrote:

Ok Now I think I am getting it. But I I keep getting a compile error wher it
says
Set rng = .resize ( .Rows.count - 1, .colums.count) any help there?

"JP" wrote:

Sorry I just realized you were asking for a new sheet, not a new
workbook. You could simply change "Set X = Workbooks.Add" to add a
sheet instead of a workbook, Dim X as Excel.Sheet instead, and change
the copy line to "rng.Copy X..Range("A1")" and it should still work.

HTH,
JP

On Jan 9, 12:04 pm, JP wrote:

Sub autofiltvisibleandcopytonewwkbk()

Dim rng As Excel.Range
Dim X As Excel.Workbook

Set rng = ActiveSheet.UsedRange.Rows

With rng
.AutoFilter Field:=6, Criteria1:="=13"
End With

With ActiveSheet.AutoFilter.Range
On Error Resume Next
Set rng = .Resize(.Rows.count -
1, .Columns.count).SpecialCells(xlCellTypeVisible)
On Error GoTo 0
End With

Set X = Workbooks.Add

rng.Copy X.Sheets(1).Range("A1")

End Sub





  #11   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Moving Info from onw sheet to another

Mike

Don't despair, we'll get you going yet. The revised code from JP autofilters
the activesheet and finds all rows with "13" in Column F.

Adds a new sheet and copies the filtered rows to that sheet.

Sub autofiltvisibleandcopytonewwkbk()
Dim rng As Range
Set rng = ActiveSheet.UsedRange.Rows
With rng
.AutoFilter Field:=6, Criteria1:="13"
End With

With ActiveSheet.AutoFilter.Range
On Error Resume Next
Set rng = .Resize(Rows.Count - 1, _
Columns.Count).SpecialCells(xlCellTypeVisible)
On Error GoTo 0
End With

rng.Copy Sheets.Add.Range("A1")
End Sub


Gord


On Wed, 9 Jan 2008 11:46:01 -0800, Mike wrote:

Man this is making me CrAzY !!!!! Thank you All for your help. But this WAY
OVER MY HEAD! I have a headache now from trying to get this... LOL I guess I
need to take some course's on MVB and writting macro's.

"Gord Dibben" wrote:

Mike

That line is part of the next line........wordwrap gotcha.

Set rng = .Resize(.Rows.Count - 1, _
.Columns.Count).SpecialCells(xlCellTypeVisible)

Note I have added the underscore which is a line-continuation character.


Gord Dibben MS Excel MVP

On Wed, 9 Jan 2008 10:31:03 -0800, Mike wrote:

Ok Now I think I am getting it. But I I keep getting a compile error wher it
says
Set rng = .resize ( .Rows.count - 1, .colums.count) any help there?

"JP" wrote:

Sorry I just realized you were asking for a new sheet, not a new
workbook. You could simply change "Set X = Workbooks.Add" to add a
sheet instead of a workbook, Dim X as Excel.Sheet instead, and change
the copy line to "rng.Copy X..Range("A1")" and it should still work.

HTH,
JP

On Jan 9, 12:04 pm, JP wrote:

Sub autofiltvisibleandcopytonewwkbk()

Dim rng As Excel.Range
Dim X As Excel.Workbook

Set rng = ActiveSheet.UsedRange.Rows

With rng
.AutoFilter Field:=6, Criteria1:="=13"
End With

With ActiveSheet.AutoFilter.Range
On Error Resume Next
Set rng = .Resize(.Rows.count -
1, .Columns.count).SpecialCells(xlCellTypeVisible)
On Error GoTo 0
End With

Set X = Workbooks.Add

rng.Copy X.Sheets(1).Range("A1")

End Sub




  #12   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,101
Default Moving Info from onw sheet to another

Gord,
Again thanks for your help... You too JP, But this is WAY to much for me. I
have gotten past the compiling error now it is saying something about my
marco is not digitly signed.... I give up, Surrender even. is there like a
=index type command I can use instead ???? I hope so otherwise I am lost.

Mike

"Gord Dibben" wrote:

Mike

Don't despair, we'll get you going yet. The revised code from JP autofilters
the activesheet and finds all rows with "13" in Column F.

Adds a new sheet and copies the filtered rows to that sheet.

Sub autofiltvisibleandcopytonewwkbk()
Dim rng As Range
Set rng = ActiveSheet.UsedRange.Rows
With rng
.AutoFilter Field:=6, Criteria1:="13"
End With

With ActiveSheet.AutoFilter.Range
On Error Resume Next
Set rng = .Resize(Rows.Count - 1, _
Columns.Count).SpecialCells(xlCellTypeVisible)
On Error GoTo 0
End With

rng.Copy Sheets.Add.Range("A1")
End Sub


Gord


On Wed, 9 Jan 2008 11:46:01 -0800, Mike wrote:

Man this is making me CrAzY !!!!! Thank you All for your help. But this WAY
OVER MY HEAD! I have a headache now from trying to get this... LOL I guess I
need to take some course's on MVB and writting macro's.

"Gord Dibben" wrote:

Mike

That line is part of the next line........wordwrap gotcha.

Set rng = .Resize(.Rows.Count - 1, _
.Columns.Count).SpecialCells(xlCellTypeVisible)

Note I have added the underscore which is a line-continuation character.


Gord Dibben MS Excel MVP

On Wed, 9 Jan 2008 10:31:03 -0800, Mike wrote:

Ok Now I think I am getting it. But I I keep getting a compile error wher it
says
Set rng = .resize ( .Rows.count - 1, .colums.count) any help there?

"JP" wrote:

Sorry I just realized you were asking for a new sheet, not a new
workbook. You could simply change "Set X = Workbooks.Add" to add a
sheet instead of a workbook, Dim X as Excel.Sheet instead, and change
the copy line to "rng.Copy X..Range("A1")" and it should still work.

HTH,
JP

On Jan 9, 12:04 pm, JP wrote:

Sub autofiltvisibleandcopytonewwkbk()

Dim rng As Excel.Range
Dim X As Excel.Workbook

Set rng = ActiveSheet.UsedRange.Rows

With rng
.AutoFilter Field:=6, Criteria1:="=13"
End With

With ActiveSheet.AutoFilter.Range
On Error Resume Next
Set rng = .Resize(.Rows.count -
1, .Columns.count).SpecialCells(xlCellTypeVisible)
On Error GoTo 0
End With

Set X = Workbooks.Add

rng.Copy X.Sheets(1).Range("A1")

End Sub





  #13   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Moving Info from onw sheet to another

What are the security settings under ToolsOptionsSecurityMacros?

Set to medium and try again.

But maybe you have gone as far as you're willing to work for.

Too bad......VBA and macros opens a whole new world of efficiency for Excel
users.


Gord

On Wed, 9 Jan 2008 19:39:06 -0800, Mike wrote:

Gord,
Again thanks for your help... You too JP, But this is WAY to much for me. I
have gotten past the compiling error now it is saying something about my
marco is not digitly signed.... I give up, Surrender even. is there like a
=index type command I can use instead ???? I hope so otherwise I am lost.

Mike

"Gord Dibben" wrote:

Mike

Don't despair, we'll get you going yet. The revised code from JP autofilters
the activesheet and finds all rows with "13" in Column F.

Adds a new sheet and copies the filtered rows to that sheet.

Sub autofiltvisibleandcopytonewwkbk()
Dim rng As Range
Set rng = ActiveSheet.UsedRange.Rows
With rng
.AutoFilter Field:=6, Criteria1:="13"
End With

With ActiveSheet.AutoFilter.Range
On Error Resume Next
Set rng = .Resize(Rows.Count - 1, _
Columns.Count).SpecialCells(xlCellTypeVisible)
On Error GoTo 0
End With

rng.Copy Sheets.Add.Range("A1")
End Sub


Gord


On Wed, 9 Jan 2008 11:46:01 -0800, Mike wrote:

Man this is making me CrAzY !!!!! Thank you All for your help. But this WAY
OVER MY HEAD! I have a headache now from trying to get this... LOL I guess I
need to take some course's on MVB and writting macro's.

"Gord Dibben" wrote:

Mike

That line is part of the next line........wordwrap gotcha.

Set rng = .Resize(.Rows.Count - 1, _
.Columns.Count).SpecialCells(xlCellTypeVisible)

Note I have added the underscore which is a line-continuation character.


Gord Dibben MS Excel MVP

On Wed, 9 Jan 2008 10:31:03 -0800, Mike wrote:

Ok Now I think I am getting it. But I I keep getting a compile error wher it
says
Set rng = .resize ( .Rows.count - 1, .colums.count) any help there?

"JP" wrote:

Sorry I just realized you were asking for a new sheet, not a new
workbook. You could simply change "Set X = Workbooks.Add" to add a
sheet instead of a workbook, Dim X as Excel.Sheet instead, and change
the copy line to "rng.Copy X..Range("A1")" and it should still work.

HTH,
JP

On Jan 9, 12:04 pm, JP wrote:

Sub autofiltvisibleandcopytonewwkbk()

Dim rng As Excel.Range
Dim X As Excel.Workbook

Set rng = ActiveSheet.UsedRange.Rows

With rng
.AutoFilter Field:=6, Criteria1:="=13"
End With

With ActiveSheet.AutoFilter.Range
On Error Resume Next
Set rng = .Resize(.Rows.count -
1, .Columns.count).SpecialCells(xlCellTypeVisible)
On Error GoTo 0
End With

Set X = Workbooks.Add

rng.Copy X.Sheets(1).Range("A1")

End Sub






  #14   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 897
Default Moving Info from onw sheet to another

At this point I recommend you just apply the autofilter to your data,
filter accordingly, then paste the rows into another sheet. This is
what the macro was doing for you, but no reason why you could not do
it manually.

1. Click inside your data area, choose DataFilterAutofilter
2. Click the dropdown arrow in the "Pier" column and choose the value
you want to view
3. Highlight and copy the rows, paste into a new sheet.


HTH,
JP


On Jan 9, 10:39*pm, Mike wrote:
Gord,
*Again thanks for your help... You too JP, But this is WAY to much for me. I
have gotten past the compiling error now it is saying something about my
marco is not digitly signed.... I give up, Surrender even. is there like a
=index type command I can use instead ???? I hope so otherwise I am lost..

Mike


  #15   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,101
Default Moving Info from onw sheet to another

I am willing to work at it more. Just have ALOT of questions that need to be
answered. Like Once a macro is made can you immbed it into a worksheet. How
many macro's can you have running in in one workbook at a time. I have so
many many you can suggest a course I can learn about Excel and it's other
fuctions. Here is another question I came up with. With the code below you
sent me. the SUB line does the autofiltvisibleandcopytonewwkbk() have to be
there or is that the name of the filter? Next is where it says rng. Copy
Sheets.Add.Range("A1") is the A1 supposed to be the name of the sheet I want
the filter to search for the info??

Sub autofiltvisibleandcopytonewwkbk()
Dim rng As Range
Set rng = ActiveSheet.UsedRange.Rows
With rng
.AutoFilter Field:=6, Criteria1:="13"
End With

With ActiveSheet.AutoFilter.Range
On Error Resume Next
Set rng = .Resize(Rows.Count - 1, _
Columns.Count).SpecialCells(xlCellTypeVisible)
On Error GoTo 0
End With

rng.Copy Sheets.Add.Range("A1")
End Sub


  #16   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 897
Default Moving Info from onw sheet to another

You asked:

Once a macro is made can you immbed it into a worksheet.


Not exactly, it is placed in a hidden code module which is part of the
programming environment.

How many macro's can you have running in in one workbook at a time.


*Running*, only one, but you can have many different macros stored in
a module and can use them as needed.

the SUB line does the autofiltvisibleandcopytonewwkbk() have to be there or is that the name of the filter?


Yes, the "Sub" line tells Excel that you have a procedure and its
name. You could change it to anything you want, I just made up a name
for purposes of demonstration.

where it says rng.Copy Sheets.Add.Range("A1") is the A1 supposed to be the name of the sheet I want the filter to search for the info??


A1 is the cell on the new sheet added by the macro, where the filtered
rows are going to be placed. Remember you asked for the applicable
rows to be copied to a new sheet, this is the functionality that does
it for you.

You definitely want to check out http://www.rondebruin.nl/code.htm and
http://www.mvps.org/dmcritchie/excel/getstarted.htm for help on basics
like where to put macros and how to use them.


HTH,
JP


On Jan 10, 11:51*am, Mike wrote:
I am willing to work at it more. Just have ALOT of questions that need to be
answered. Like Once a macro is made can you immbed it into a worksheet. How
many macro's can you have running in in one workbook at a time. I have so
many many you can suggest a course I can learn about Excel and it's other
fuctions. Here is another question I came up with. *With the code below you
sent me. the SUB line does the autofiltvisibleandcopytonewwkbk() have to be
there or is that the name of the filter? Next is where it says rng. Copy
Sheets.Add.Range("A1") is the A1 supposed to be the name of the sheet I want
the filter to search for the info??

*Sub autofiltvisibleandcopytonewwkbk()
* Dim rng As Range
* * * *Set rng = ActiveSheet.UsedRange.Rows
* With rng
* * * .AutoFilter Field:=6, Criteria1:="13"
* End With

* With ActiveSheet.AutoFilter.Range
* On Error Resume Next
* * *Set rng = .Resize(Rows.Count - 1, _
* * * Columns.Count).SpecialCells(xlCellTypeVisible)
* On Error GoTo 0
* End With

* rng.Copy Sheets.Add.Range("A1")
* End Sub


  #17   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,101
Default Moving Info from onw sheet to another

WOW!!!!!!!!!!!!!!!! This is really starting to come together... BUT one other
question. Suppose I already have a sheet formated (i.e) with headers and
footers set. How do I get the macro to put the info onto that sheet? or is
that asking to much??? LOL

Thank you SOOOOOO Much JP

"JP" wrote:

You asked:

Once a macro is made can you immbed it into a worksheet.


Not exactly, it is placed in a hidden code module which is part of the
programming environment.

How many macro's can you have running in in one workbook at a time.


*Running*, only one, but you can have many different macros stored in
a module and can use them as needed.

the SUB line does the autofiltvisibleandcopytonewwkbk() have to be there or is that the name of the filter?


Yes, the "Sub" line tells Excel that you have a procedure and its
name. You could change it to anything you want, I just made up a name
for purposes of demonstration.

where it says rng.Copy Sheets.Add.Range("A1") is the A1 supposed to be the name of the sheet I want the filter to search for the info??


A1 is the cell on the new sheet added by the macro, where the filtered
rows are going to be placed. Remember you asked for the applicable
rows to be copied to a new sheet, this is the functionality that does
it for you.

You definitely want to check out http://www.rondebruin.nl/code.htm and
http://www.mvps.org/dmcritchie/excel/getstarted.htm for help on basics
like where to put macros and how to use them.


HTH,
JP


On Jan 10, 11:51 am, Mike wrote:
I am willing to work at it more. Just have ALOT of questions that need to be
answered. Like Once a macro is made can you immbed it into a worksheet. How
many macro's can you have running in in one workbook at a time. I have so
many many you can suggest a course I can learn about Excel and it's other
fuctions. Here is another question I came up with. With the code below you
sent me. the SUB line does the autofiltvisibleandcopytonewwkbk() have to be
there or is that the name of the filter? Next is where it says rng. Copy
Sheets.Add.Range("A1") is the A1 supposed to be the name of the sheet I want
the filter to search for the info??

Sub autofiltvisibleandcopytonewwkbk()
Dim rng As Range
Set rng = ActiveSheet.UsedRange.Rows
With rng
.AutoFilter Field:=6, Criteria1:="13"
End With

With ActiveSheet.AutoFilter.Range
On Error Resume Next
Set rng = .Resize(Rows.Count - 1, _
Columns.Count).SpecialCells(xlCellTypeVisible)
On Error GoTo 0
End With

rng.Copy Sheets.Add.Range("A1")
End Sub



  #18   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 897
Default Moving Info from onw sheet to another

This updated code will add the header and footer to the new worksheet.
It assumes that the footer text is in the worksheet in a range
A100:G103. If you put this text somewhere else, simply adjust the
range in the macro.


Sub autofiltvisibleandcopytonewwkbk()
Dim rng As Excel.Range
Dim rng2 As Excel.Range
Dim NewSht As Worksheet

Set rng = ActiveSheet.UsedRange.Rows
' adjust the line below to fit your worksheet
Set rng2 = Range("A100:G103")

With rng
.AutoFilter Field:=6, Criteria1:="13"
End With

With ActiveSheet.AutoFilter.Range
On Error Resume Next
Set rng = .Resize(Rows.count, _
Columns.count).SpecialCells(xlCellTypeVisible)
On Error GoTo 0
End With

Set NewSht = Sheets.Add
rng.Copy NewSht.Range("A1")

rng2.Copy NewSht.Range("A65536").End(xlUp).Offset(2, 0)

End Sub

On Jan 10, 12:36*pm, Mike wrote:
WOW!!!!!!!!!!!!!!!! This is really starting to come together... BUT one other
question. Suppose I already have a sheet formated (i.e) with headers and
footers set. How do I get the macro to put the info onto that sheet? or is
that asking to much??? LOL

Thank you SOOOOOO Much JP


  #19   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Moving Info from onw sheet to another

Mike

Good to see you did not surrender and are sticking with it.

You can add to the macro to format the new sheet as you wish, which requires
more lines of code or you could go with a sheet template.

Create a workbook with one sheet.

Format that sheet as you wish with headers and footers and anything else you
want.

FileSave AsFile TypeMS Excel Template(*.xlt)

Save as SHEET.......let Excel add the .xlt

Place this SHEET.xlt in your XLSTART folder

In the macro change this line

rng.Copy Sheets.Add.Range("A1")

which uses the Excel default worksheet,

to this, which uses your custom sheet.

rng.Copy Sheets.Add(Type:="Worksheet").Range("A1")

NOTE: SHEET.xlt will also be the default for any sheet added through
InsertWorksheet.


Gord

On Thu, 10 Jan 2008 09:36:00 -0800, Mike wrote:

WOW!!!!!!!!!!!!!!!! This is really starting to come together... BUT one other
question. Suppose I already have a sheet formated (i.e) with headers and
footers set. How do I get the macro to put the info onto that sheet? or is
that asking to much??? LOL

Thank you SOOOOOO Much JP

"JP" wrote:

You asked:

Once a macro is made can you immbed it into a worksheet.


Not exactly, it is placed in a hidden code module which is part of the
programming environment.

How many macro's can you have running in in one workbook at a time.


*Running*, only one, but you can have many different macros stored in
a module and can use them as needed.

the SUB line does the autofiltvisibleandcopytonewwkbk() have to be there or is that the name of the filter?


Yes, the "Sub" line tells Excel that you have a procedure and its
name. You could change it to anything you want, I just made up a name
for purposes of demonstration.

where it says rng.Copy Sheets.Add.Range("A1") is the A1 supposed to be the name of the sheet I want the filter to search for the info??


A1 is the cell on the new sheet added by the macro, where the filtered
rows are going to be placed. Remember you asked for the applicable
rows to be copied to a new sheet, this is the functionality that does
it for you.

You definitely want to check out http://www.rondebruin.nl/code.htm and
http://www.mvps.org/dmcritchie/excel/getstarted.htm for help on basics
like where to put macros and how to use them.


HTH,
JP


On Jan 10, 11:51 am, Mike wrote:
I am willing to work at it more. Just have ALOT of questions that need to be
answered. Like Once a macro is made can you immbed it into a worksheet. How
many macro's can you have running in in one workbook at a time. I have so
many many you can suggest a course I can learn about Excel and it's other
fuctions. Here is another question I came up with. With the code below you
sent me. the SUB line does the autofiltvisibleandcopytonewwkbk() have to be
there or is that the name of the filter? Next is where it says rng. Copy
Sheets.Add.Range("A1") is the A1 supposed to be the name of the sheet I want
the filter to search for the info??

Sub autofiltvisibleandcopytonewwkbk()
Dim rng As Range
Set rng = ActiveSheet.UsedRange.Rows
With rng
.AutoFilter Field:=6, Criteria1:="13"
End With

With ActiveSheet.AutoFilter.Range
On Error Resume Next
Set rng = .Resize(Rows.Count - 1, _
Columns.Count).SpecialCells(xlCellTypeVisible)
On Error GoTo 0
End With

rng.Copy Sheets.Add.Range("A1")
End Sub




  #20   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,101
Default Moving Info from onw sheet to another

Thanks JP But I dont think you understand what I trying to do. Dont get me
wrong Thank you SOOO MUCH for all your help. If I ramble I am sorry.. I am
trying to set up a filter that can take the info from the (Sort Sheet) Where
the info is stored. Sort it By Piers (Which there are 16 of them) to each
pier having its own sheet With it's own headers and footers. and do this
without having to copy and paste. I will see what this you code you gave can
do.

Thanks again
Mike

"JP" wrote:

This updated code will add the header and footer to the new worksheet.
It assumes that the footer text is in the worksheet in a range
A100:G103. If you put this text somewhere else, simply adjust the
range in the macro.


Sub autofiltvisibleandcopytonewwkbk()
Dim rng As Excel.Range
Dim rng2 As Excel.Range
Dim NewSht As Worksheet

Set rng = ActiveSheet.UsedRange.Rows
' adjust the line below to fit your worksheet
Set rng2 = Range("A100:G103")

With rng
.AutoFilter Field:=6, Criteria1:="13"
End With

With ActiveSheet.AutoFilter.Range
On Error Resume Next
Set rng = .Resize(Rows.count, _
Columns.count).SpecialCells(xlCellTypeVisible)
On Error GoTo 0
End With

Set NewSht = Sheets.Add
rng.Copy NewSht.Range("A1")

rng2.Copy NewSht.Range("A65536").End(xlUp).Offset(2, 0)

End Sub

On Jan 10, 12:36 pm, Mike wrote:
WOW!!!!!!!!!!!!!!!! This is really starting to come together... BUT one other
question. Suppose I already have a sheet formated (i.e) with headers and
footers set. How do I get the macro to put the info onto that sheet? or is
that asking to much??? LOL

Thank you SOOOOOO Much JP





  #21   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 897
Default Moving Info from onw sheet to another

Someone posted a link earlier today to a macro that can do this, I'll
try to find it for you.

--JP

On Jan 10, 1:26*pm, Mike wrote:
Thanks JP But I dont think you understand what I trying to do. Dont get me
wrong Thank you SOOO MUCH for all your help. If I ramble I am sorry.. I am
trying to set up a filter that can take the info from the (Sort Sheet) Where
the info is stored. Sort it By Piers (Which there are 16 of them) to each
pier having its own sheet With it's own headers and footers. and do this
without having to copy and paste. I will see what this you code you gave can
do.

Thanks again
Mike


  #22   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,101
Default Moving Info from onw sheet to another

Thanks I was just looking at that page

"JP" wrote:

Someone posted a link earlier today to a macro that can do this, I'll
try to find it for you.

--JP

On Jan 10, 1:26 pm, Mike wrote:
Thanks JP But I dont think you understand what I trying to do. Dont get me
wrong Thank you SOOO MUCH for all your help. If I ramble I am sorry.. I am
trying to set up a filter that can take the info from the (Sort Sheet) Where
the info is stored. Sort it By Piers (Which there are 16 of them) to each
pier having its own sheet With it's own headers and footers. and do this
without having to copy and paste. I will see what this you code you gave can
do.

Thanks again
Mike



  #23   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 897
Default Moving Info from onw sheet to another

Check out the thread "Extract Whole Row If Q" in the
microsoft.public.excel.programming group, you will need some more
macro expertise to debug and implement this code for your project.


HTH,
JP


On Jan 10, 1:26*pm, Mike wrote:
Thanks JP But I dont think you understand what I trying to do. Dont get me
wrong Thank you SOOO MUCH for all your help. If I ramble I am sorry.. I am
trying to set up a filter that can take the info from the (Sort Sheet) Where
the info is stored. Sort it By Piers (Which there are 16 of them) to each
pier having its own sheet With it's own headers and footers. and do this
without having to copy and paste. I will see what this you code you gave can
do.

Thanks again
Mike



"JP" wrote:
This updated code will add the header and footer to the new worksheet.
It assumes that the footer text is in the worksheet in a range
A100:G103. If you put this text somewhere else, simply adjust the
range in the macro.


*Sub autofiltvisibleandcopytonewwkbk()
* Dim rng As Excel.Range
* Dim rng2 As Excel.Range
* Dim NewSht As Worksheet


* * * *Set rng = ActiveSheet.UsedRange.Rows
' adjust the line below to fit your worksheet
* * * *Set rng2 = Range("A100:G103")


* With rng
* * * .AutoFilter Field:=6, Criteria1:="13"
* End With


* With ActiveSheet.AutoFilter.Range
* On Error Resume Next
* * *Set rng = .Resize(Rows.count, _
* * * Columns.count).SpecialCells(xlCellTypeVisible)
* On Error GoTo 0
* End With


*Set NewSht = Sheets.Add
* rng.Copy NewSht.Range("A1")


* rng2.Copy NewSht.Range("A65536").End(xlUp).Offset(2, 0)


* End Sub


On Jan 10, 12:36 pm, Mike wrote:
WOW!!!!!!!!!!!!!!!! This is really starting to come together... BUT one other
question. Suppose I already have a sheet formated (i.e) with headers and
footers set. How do I get the macro to put the info onto that sheet? or is
that asking to much??? LOL


Thank you SOOOOOO Much JP- Hide quoted text -


- Show quoted text -


  #24   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,101
Default Moving Info from onw sheet to another

I am a MACRO making fool. I am getting it to everything I need it took a
while to get the exact coding and order down but I am getting there... I just
hope there is not a limit of lines of code I can put into a macro. LOL!!!! My
first Macro has about 308 lines of code...LOL!!!!!!

"JP" wrote:

Check out the thread "Extract Whole Row If Q" in the
microsoft.public.excel.programming group, you will need some more
macro expertise to debug and implement this code for your project.


HTH,
JP


On Jan 10, 1:26 pm, Mike wrote:
Thanks JP But I dont think you understand what I trying to do. Dont get me
wrong Thank you SOOO MUCH for all your help. If I ramble I am sorry.. I am
trying to set up a filter that can take the info from the (Sort Sheet) Where
the info is stored. Sort it By Piers (Which there are 16 of them) to each
pier having its own sheet With it's own headers and footers. and do this
without having to copy and paste. I will see what this you code you gave can
do.

Thanks again
Mike



"JP" wrote:
This updated code will add the header and footer to the new worksheet.
It assumes that the footer text is in the worksheet in a range
A100:G103. If you put this text somewhere else, simply adjust the
range in the macro.


Sub autofiltvisibleandcopytonewwkbk()
Dim rng As Excel.Range
Dim rng2 As Excel.Range
Dim NewSht As Worksheet


Set rng = ActiveSheet.UsedRange.Rows
' adjust the line below to fit your worksheet
Set rng2 = Range("A100:G103")


With rng
.AutoFilter Field:=6, Criteria1:="13"
End With


With ActiveSheet.AutoFilter.Range
On Error Resume Next
Set rng = .Resize(Rows.count, _
Columns.count).SpecialCells(xlCellTypeVisible)
On Error GoTo 0
End With


Set NewSht = Sheets.Add
rng.Copy NewSht.Range("A1")


rng2.Copy NewSht.Range("A65536").End(xlUp).Offset(2, 0)


End Sub


On Jan 10, 12:36 pm, Mike wrote:
WOW!!!!!!!!!!!!!!!! This is really starting to come together... BUT one other
question. Suppose I already have a sheet formated (i.e) with headers and
footers set. How do I get the macro to put the info onto that sheet? or is
that asking to much??? LOL


Thank you SOOOOOO Much JP- Hide quoted text -


- Show quoted text -



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
Moving last info in column of worksheet to another in same workboo sodat96 New Users to Excel 6 November 23rd 07 11:26 PM
Automatic moving cell Info Troy Excel Worksheet Functions 2 May 1st 07 12:00 AM
IF function? Moving the same info from one worksheet to another. Naomi Excel Worksheet Functions 3 October 26th 06 07:46 PM
How do you perform lookups when the info is always moving? Jeze77 New Users to Excel 3 March 31st 06 03:42 PM
How do I compare info in on sheet to info in another? Fanney Excel Discussion (Misc queries) 7 February 25th 06 02:16 AM


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