Thread: Copy and Paste
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Jackson Jim Jackson is offline
external usenet poster
 
Posts: 324
Default Copy and Paste

The following will go down 20 rows (you can change the "20" to whatever you
need). If the target cells are not in the same order, it will be a bit more
complex.

Sub cp()
Sheets("Sheet1").Activate
Range("A1").Activate
For x = 1 To 20
If ActiveCell < "" Then
ActiveCell.Offset(0, 2) = ActiveCell
ActiveCell.Offset(1, 0).Activate
Else
ActiveCell.Offset(1, 0).Activate
End If
Next
End Sub
--
Best wishes,

Jim


"RigasMinho" wrote:

Is there a way to make a macro / command button that selects all the
values in a column only if they contain information and paste it
somewhere else?

So say you have a column that has 4 cells in it.

cell 1 has: "Hello"
cell 2 is: empty
cell 3 is "3"
cell 4 is "Bye"

When you run the macro it will only copy Cell 1, Cell 3, And Cell 4 and
paste those into another cell.