Copying data at specific positions

S

Sylvia

Hi,

I want to write a macro for copying perticular cell from worksheet1 to
worksheet2 at some specified position only.
for instance: My data will be there only in the row 2 of Worksheet 1. I
want to search which cells contains the value and copy that value in the
row 1 of the worksheet2, but at the same column position. i.e. data of
column a2 (Worksheet 1) will be copied at a1 position in worksheet 2.
b2(Worksheet 1) to b1(Worksheet 2). g2(Worksheet 1) to g1(Worksheet 2)
and so on... If any cell is blank then ignore that.

Thanks,
Sylvia
 
E

Executor

Hi Sylvia,

I have cooked up:

Sub SylviasCopy()
Dim intLook As Integer
Dim intCol As Integer

intLook = 10

For intCol = 1 To 14
If Worksheets("Sheet1").Cells(2, intCol).Value = intLook Then
Worksheets("Sheet2").Cells(1, intCol).Value = intLook
' Exit For
End If
Next

End Sub

This will copy all valid values from sheet1 to sheet2
Top copy only the first valid value remove the character before Exit
For

Hoop this helps,

Executor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top