Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Copy cells when column contains data

I need a macro that would copy the information in a range of cells only if
there is a value entered in a column of the same row.

Do I need a macro to do this? If I do, could someone show me where to
start writing it?


Thanks


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Copy cells when column contains data

Kirk,

You can use the Autofilter method: this example will copy a row only if the
second column of the activecell's currentregion is filled, then will copy to
below the last entry of column A of the same sheet, leaving three blank rows
between:

With ActiveCell.CurrentRegion
.AutoFilter Field:=2, Criteria1:="<"
.SpecialCells(xlCellTypeVisible).Copy Range("A65536").End(xlUp)(5)
.AutoFilter
End With

HTH,
Bernie
MS Excel MVP

"Kirk A" wrote in message
...
I need a macro that would copy the information in a range of cells only if
there is a value entered in a column of the same row.

Do I need a macro to do this? If I do, could someone show me where to
start writing it?


Thanks




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Copy cells when column contains data

I have several columns of data. How would I make this example copy the data
in the first, second and fourth column?

I have added a line to the macro to place the data on a new worksheet, but
it adds the three blank lines at the top of the sheet. How do I keep from
adding these lines?

Thanks for you help.
Kirk

"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Kirk,

You can use the Autofilter method: this example will copy a row only if

the
second column of the activecell's currentregion is filled, then will copy

to
below the last entry of column A of the same sheet, leaving three blank

rows
between:

With ActiveCell.CurrentRegion
.AutoFilter Field:=2, Criteria1:="<"
.SpecialCells(xlCellTypeVisible).Copy Range("A65536").End(xlUp)(5)
.AutoFilter
End With

HTH,
Bernie
MS Excel MVP

"Kirk A" wrote in message
...
I need a macro that would copy the information in a range of cells only

if
there is a value entered in a column of the same row.

Do I need a macro to do this? If I do, could someone show me where to
start writing it?


Thanks






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Copy cells when column contains data

Kirk,

Something like:

With ActiveCell.CurrentRegion
.AutoFilter Field:=2, Criteria1:="<"
.SpecialCells(xlCellTypeVisible).Range("A:B").Copy _
Worksheets("Sheet2").Range("A1")
.SpecialCells(xlCellTypeVisible).Range("D:D").Copy _
Worksheets("Sheet2").Range("C1")
.AutoFilter
End With

HTH,
Bernie
MS Excel MVP

"Kirk A" wrote in message
...
I have several columns of data. How would I make this example copy the

data
in the first, second and fourth column?

I have added a line to the macro to place the data on a new worksheet, but
it adds the three blank lines at the top of the sheet. How do I keep from
adding these lines?

Thanks for you help.
Kirk

"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Kirk,

You can use the Autofilter method: this example will copy a row only if

the
second column of the activecell's currentregion is filled, then will

copy
to
below the last entry of column A of the same sheet, leaving three blank

rows
between:

With ActiveCell.CurrentRegion
.AutoFilter Field:=2, Criteria1:="<"
.SpecialCells(xlCellTypeVisible).Copy Range("A65536").End(xlUp)(5)
.AutoFilter
End With

HTH,
Bernie
MS Excel MVP

"Kirk A" wrote in message
...
I need a macro that would copy the information in a range of cells

only
if
there is a value entered in a column of the same row.

Do I need a macro to do this? If I do, could someone show me where

to
start writing it?


Thanks








  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Copy cells when column contains data

Thank you.


"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Kirk,

Something like:

With ActiveCell.CurrentRegion
.AutoFilter Field:=2, Criteria1:="<"
.SpecialCells(xlCellTypeVisible).Range("A:B").Copy _
Worksheets("Sheet2").Range("A1")
.SpecialCells(xlCellTypeVisible).Range("D:D").Copy _
Worksheets("Sheet2").Range("C1")
.AutoFilter
End With

HTH,
Bernie
MS Excel MVP

"Kirk A" wrote in message
...
I have several columns of data. How would I make this example copy the

data
in the first, second and fourth column?

I have added a line to the macro to place the data on a new worksheet,

but
it adds the three blank lines at the top of the sheet. How do I keep

from
adding these lines?

Thanks for you help.
Kirk

"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Kirk,

You can use the Autofilter method: this example will copy a row only

if
the
second column of the activecell's currentregion is filled, then will

copy
to
below the last entry of column A of the same sheet, leaving three

blank
rows
between:

With ActiveCell.CurrentRegion
.AutoFilter Field:=2, Criteria1:="<"
.SpecialCells(xlCellTypeVisible).Copy Range("A65536").End(xlUp)(5)
.AutoFilter
End With

HTH,
Bernie
MS Excel MVP

"Kirk A" wrote in message
...
I need a macro that would copy the information in a range of cells

only
if
there is a value entered in a column of the same row.

Do I need a macro to do this? If I do, could someone show me where

to
start writing it?


Thanks










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
macro to copy following cells in the same column pol Excel Discussion (Misc queries) 4 October 15th 08 06:11 PM
How to copy values available in different cells of a column into d Satish Excel Discussion (Misc queries) 3 August 2nd 07 06:30 AM
Macro, Copy Selected Cells Down a Column DB33 Excel Discussion (Misc queries) 9 February 15th 06 09:29 PM
How can i copy a group of cells in a row to a column? yargila Excel Discussion (Misc queries) 2 August 10th 05 03:58 AM
Copy cells to another column with VBA Joe E via OfficeKB.com Excel Discussion (Misc queries) 1 January 26th 05 04:32 PM


All times are GMT +1. The time now is 08:37 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"