Copy Rows to Existing Worksheets

  • Thread starter Thread starter HamishM
  • Start date Start date
H

HamishM

Hi,

I need to copy a number of rows from a master worksheet to existin
worksheets within the same work book.

Ideally i would like to check the values of one column and send tha
row to the corresponding worksheet based on the result.

e.g.

check row 1 and if Value in Column H = Blue,
send entire row to worksheet 'Blue'.

repeat for all rows in master sheet.

Hope i am making sense and that someone can help.

thanks,
Hamis
 
how about something like
Sub copyblue()
For Each c In Range("e2:e22")
If UCase(c) = "B" Then
x = Sheets("sheet4").Cells(Rows.Count, "a") _
..End(xlUp).Row + 1
c.EntireRow.Copy Sheets("Sheet4").Cells(x, "a")
End If
Next
End Sub
 
Thanks Don.

I'm quite new to VBA so could you explain what each of the lines ar
doing and the variables?

Appreciate your help
Hamis
 
Macro is looking for cells that contain "b" or "B" in the range and copying
the row to next available row on sheet 4 in col A.
The line with the space & underscore ( _ ) is a "continuation" character to
make the line into one line.

Sub copyblue()
For Each c In Range("e2:e22")
If UCase(c) = "B" Then
x = Sheets("sheet4").Cells(Rows.Count, "a") _
..End(xlUp).Row + 1
c.EntireRow.Copy Sheets("Sheet4").Cells(x, "a")
End If
Next
End Sub
 
Back
Top