Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Conditional copy & paste
Hello,
I'm new to both the newsgroup and VBA programming. I have a simple problem that I can't seem to work past and I am looking for some help. I have an Excel spreadsheet with data in adjacent columns. The number of rows is variable. I would like to copy the data from the B column to the A column if the data in B is zero. 45 0 0 23 (copy this B cell to the adjacent a cell) 12 0 10 0 I'm trying to use an If Then statement but I can't seem to copy from one cell and paste to another in the same statement. Thanks RonD |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Conditional copy & paste
Sub ConditionalPaste()
Dim c As Range For Each c In Range("B1:B1000").Cells If c 0 Then c.Copy c.Offset(, -1) Next End Sub -- Vasant "RonD" wrote in message ... Hello, I'm new to both the newsgroup and VBA programming. I have a simple problem that I can't seem to work past and I am looking for some help. I have an Excel spreadsheet with data in adjacent columns. The number of rows is variable. I would like to copy the data from the B column to the A column if the data in B is zero. 45 0 0 23 (copy this B cell to the adjacent a cell) 12 0 10 0 I'm trying to use an If Then statement but I can't seem to copy from one cell and paste to another in the same statement. Thanks RonD |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Copy and Paste Conditional Formatting | Excel Discussion (Misc queries) | |||
Copy Paste conditional formatting | Excel Discussion (Misc queries) | |||
Copy/Paste Conditional Format | Excel Discussion (Misc queries) | |||
Copy paste Conditional Formatting | Excel Discussion (Misc queries) | |||
Copy Paste Conditional Formatting | Excel Discussion (Misc queries) |