View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
[email protected] adambush4242@hotmail.com is offline
external usenet poster
 
Posts: 168
Default Paste Special If Statement

Ok, but it ends up the code pastes only the highlighted cell, and I need that
cell plus the next 17 cells in the column.

Please advise,

Adam Bush

"Joel" wrote:

just hard code
MyColumn = "C"

" wrote:

How could I change the code to paste special-values and to always output to
column C?

Thanks and I appreciate your help,

Adam Bush

"Joel" wrote:

highlight range of cells you want copies. Then run macro. macro will ask the
new column for the data.


Sub CopyColumns()

MyColumn = InputBox("Enter Destination Column")

Set cell = Range(MyColumn & "1")
ColumnNumber = cell.Column

MyColumnOffset = ColumnNumber - ActiveCell.Column

For Each cell In ActiveCell.CurrentRegion

If cell < 0 Then

cell.Offset(0, MyColumnOffset) = cell
End If

Next cell


End Sub
" wrote:

I want to be able to create a macro where if you click a button it pastes
values from say column Q to column C. However, I only want it to paste the
info. over if the number in the first row is not zero. If it is zero, the
macro will do nothing. Every data set I am looking at will have five columns
to paste per week, about 18 rows per column. The weeks are arranged
vertically so one would be from C1 to G 18 and the next would be from C24 to
G41. It would be great if I could use just one button but I'd settle for
using one per week.

Thanks and I'd appreciate and Ideas,

Adam Bush