View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jennifer[_2_] Jennifer[_2_] is offline
external usenet poster
 
Posts: 24
Default Copy/Paste from Different Worksheet

On Jun 4, 3:21*pm, Jeff Gross
wrote:
I posted this earlier but received no response so I'm hoping to have better
luck this time.

I have a possible of 300 rows of data on sheet2 (this is variable but no
more than 300). *Column A on sheet2 is currently blank. *The data starts in
column B of sheet2 and is the result of an "IF" type formula.

What I need the code to do is starting with row 2 on sheet2, look for data
in B2. *If *the result of the "IF" statement in B2 results in a blank cell
for B2, then go to the
next row and repeat for row 3. *If there is data in B2, copy the data in a
cell from a
different worksheet (sheet1 $C$4) into this cell and then continue on to row
3.

I think I have explained it sufficiently so any help would be greatly
appreciated.


Sub CopyMacro()
Dim X As Integer
For X = 2 To 301
If Sheet2.Cells(X, 2).Value < "" Then
Sheet2.Cells(X, 2).Value = Sheet1.Cells(4, 3).Value
End If
Next X
End Sub