Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have asked in other NG. Got some very good answers from very helpful
people (The trouble was that these people assumed that I know a great deal about EXcel...I do not)that left me a little confused. Here is my predicament I have a sheet called db1 The sheet contains data in Col A, B ,C, D,E,F,G,H,I,J I have applied a filter to this sheet. Col A is set to show only NON BLANK lines I want to copy the data currently displayed(Ie NON blank lines) to and other sheet The columns are always the same ones but the number of rows varies all the time. So I need a macro that will copy from ALL and only the visible data. (ie copy the data in the above named columns down to the last row showing . Can/will some one give me the code required to do this. Thanks and Have a very happy 2004 -- Norton Professional 2004 says this email is clean...believe it |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
One way:
Public Sub CopyVisible() Sheets("db1").Range("A1").CurrentRegion.SpecialCel ls( _ xlCellTypeVisible).Copy Destination:=Sheets(2).Range("A1") End Sub In article .rogers.com, "PCOR" wrote: I have asked in other NG. Got some very good answers from very helpful people (The trouble was that these people assumed that I know a great deal about EXcel...I do not)that left me a little confused. Here is my predicament I have a sheet called db1 The sheet contains data in Col A, B ,C, D,E,F,G,H,I,J I have applied a filter to this sheet. Col A is set to show only NON BLANK lines I want to copy the data currently displayed(Ie NON blank lines) to and other sheet The columns are always the same ones but the number of rows varies all the time. So I need a macro that will copy from ALL and only the visible data. (ie copy the data in the above named columns down to the last row showing . Can/will some one give me the code required to do this. Thanks and Have a very happy 2004 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you for the code.
It did the trick and did copy the data to the second sheet....BUT I also received an error message "Run time error 1004" "Copy method of range class failed" I wonder why the error "J.E. McGimpsey" wrote in message ... One way: Public Sub CopyVisible() Sheets("db1").Range("A1").CurrentRegion.SpecialCel ls( _ xlCellTypeVisible).Copy Destination:=Sheets(2).Range("A1") End Sub In article .rogers.com, "PCOR" wrote: I have asked in other NG. Got some very good answers from very helpful people (The trouble was that these people assumed that I know a great deal about EXcel...I do not)that left me a little confused. Here is my predicament I have a sheet called db1 The sheet contains data in Col A, B ,C, D,E,F,G,H,I,J I have applied a filter to this sheet. Col A is set to show only NON BLANK lines I want to copy the data currently displayed(Ie NON blank lines) to and other sheet The columns are always the same ones but the number of rows varies all the time. So I need a macro that will copy from ALL and only the visible data. (ie copy the data in the above named columns down to the last row showing . Can/will some one give me the code required to do this. Thanks and Have a very happy 2004 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
hope the following helps, if someone more knoledgable than me is checking my
code, what variant type should i give to "rng" Sub CopyNonBlanks() Dim i As Integer, rng As Variant Application.ScreenUpdating = False sheets("db1").select i = 0 For Each rng In Range(Range(("A1")), Range("A1").End(xlDown)) If rng < "" Then Range(rng, rng.Offset(0, 9)).Copy Sheets("Sheet2").Range("A1").Offset(i, 0).PasteSpecial i = i + 1 End If Next rng CutCopyMode = False End Sub PCOR wrote in message able.rogers.com... I have asked in other NG. Got some very good answers from very helpful people (The trouble was that these people assumed that I know a great deal about EXcel...I do not)that left me a little confused. Here is my predicament I have a sheet called db1 The sheet contains data in Col A, B ,C, D,E,F,G,H,I,J I have applied a filter to this sheet. Col A is set to show only NON BLANK lines I want to copy the data currently displayed(Ie NON blank lines) to and other sheet The columns are always the same ones but the number of rows varies all the time. So I need a macro that will copy from ALL and only the visible data. (ie copy the data in the above named columns down to the last row showing .. Can/will some one give me the code required to do this. Thanks and Have a very happy 2004 -- Norton Professional 2004 says this email is clean...believe it |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In article ,
"Stuart" wrote: what variant type should i give to "rng" Range |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to find value and then copy associated range | Excel Discussion (Misc queries) | |||
Macro copy from range | Excel Discussion (Misc queries) | |||
macro to copy range | Excel Worksheet Functions | |||
MACRO TO COPY TO A RANGE | Excel Discussion (Misc queries) | |||
Macro to copy a range | Excel Programming |