PrstgWrldwde
New Member
- Joined
- Aug 13, 2015
- Messages
- 6
I'm trying to copy a value and paste it using R1C1 function.
Most of my macro looks like this (which works):
Range("A2").Select
ActiveCell.FormulaR1C1 = "=IF(R[-1]C[-10]=""value"",R[1]C[1],"""")"
The above pattern is getting all of the values that I want into appropriate columns. Where I'm having trouble is with a particular string where I'm trying to copy/paste the cell value in one column for every instance that there is a cell with data in another column:
Range("F42").Select
Selection.Copy
Range("T2").Select
ActiveCell.FormulaR1C1 = "=IF(Range(RC[2]<>"",Selection.Paste)"
So in words: copy the value from cell F42, then paste in column T for every instance that there is an adjacent cell (RC[2]) that is not empty. I keep getting errors and have tried many different options.
Most of my macro looks like this (which works):
Range("A2").Select
ActiveCell.FormulaR1C1 = "=IF(R[-1]C[-10]=""value"",R[1]C[1],"""")"
The above pattern is getting all of the values that I want into appropriate columns. Where I'm having trouble is with a particular string where I'm trying to copy/paste the cell value in one column for every instance that there is a cell with data in another column:
Range("F42").Select
Selection.Copy
Range("T2").Select
ActiveCell.FormulaR1C1 = "=IF(Range(RC[2]<>"",Selection.Paste)"
So in words: copy the value from cell F42, then paste in column T for every instance that there is an adjacent cell (RC[2]) that is not empty. I keep getting errors and have tried many different options.