Copy cells to a row specified in another cell

P

paul

I have a sheet (sheet 1) which has data like this:-

cell-1 cell-2 cell-3 cell-4
365 Brian 45 car

and I want to run a macro etc that copies the data in
cells 2,3 & 4 to a row in sheet 2 specified by cell1 (i.e.
to row 365 of sheet 2).

How do I do this? Can someone send me the script?

Paul
 
K

Ken

Perhaps something like this:

Option Explicit
Dim CellRef As Double
Sub CopyCells()
Worksheets("Sheet1").Activate
CellRef = Cells(1, 1)
Worksheets("Sheet2").Cells(CellRef, 1) = Cells(1, 2)
Worksheets("Sheet2").Cells(CellRef, 2) = Cells(1, 3)
Worksheets("Sheet2").Cells(CellRef, 3) = Cells(1, 4)
End Sub

It will copy B1, C1 and D1 from Sheet1 to columns A, B and
C in Sheet2 based on the row number in A1 on Sheet1.
 

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